{"size": 534, "ext": "js", "max_stars_repo_path": "lib/outputTest4.js", "max_stars_repo_name": "xinkaiwang/testbed-pi", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/outputTest4.js", "max_issues_repo_name": "xinkaiwang/testbed-pi", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/outputTest4.js", "max_forks_repo_name": "xinkaiwang/testbed-pi", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.2173913043, "max_line_length": 74, "alphanum_fraction": 0.638576779}
'use strict';

require('./setup');

var gs = require('global-singleton');
var pwm = gs('output.motor1');

var stepCount = 100; // how much step is 1 loop?
var loopTimeInMs = 5*1000; // 60 seconds
var counter = 0;

function onTimeout() {
    counter ++;
    counter = counter % stepCount;
    var value = Math.sin(Math.PI * 2 * counter / stepCount - Math.PI / 2);
    console.log('value=' + value + ' delay=' + loopTimeInMs/stepCount);
    pwm(value);
    //pwm(0.1);
    setTimeout(onTimeout, loopTimeInMs/stepCount);
}

onTimeout();
