servo test

parent 64718470
Showing with 3 additions and 3 deletions
...@@ -19,7 +19,7 @@ var BLUE = new Gpio(27, {mode: Gpio.OUTPUT}); ...@@ -19,7 +19,7 @@ var BLUE = new Gpio(27, {mode: Gpio.OUTPUT});
var motor = new Gpio(13, {mode: Gpio.OUTPUT}); var motor = new Gpio(13, {mode: Gpio.OUTPUT});
var pulseWidth = 1850; var pulseWidth = 1850;
var increment = -129; var increment = -99;
var test = setInterval(function () { var test = setInterval(function () {
motor.servoWrite(pulseWidth); motor.servoWrite(pulseWidth);
...@@ -27,9 +27,9 @@ var test = setInterval(function () { ...@@ -27,9 +27,9 @@ var test = setInterval(function () {
pulseWidth += increment; pulseWidth += increment;
if (pulseWidth >= 1850) { if (pulseWidth >= 1850) {
increment = -129; increment = -99;
} else if (pulseWidth <= 550) { } else if (pulseWidth <= 550) {
increment = 129; increment = 99;
} }
}, 1000); }, 1000);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment