servo test

parent 2a1b78df
Showing with 10 additions and 7 deletions
......@@ -12,11 +12,14 @@ var RED = new Gpio(4, {mode: Gpio.OUTPUT});
var GREEN = new Gpio(17, {mode: Gpio.OUTPUT});
var BLUE = new Gpio(27, {mode: Gpio.OUTPUT});
//cierre maximo 1850
//apertura maxima 550
var motor = new Gpio(13, {mode: Gpio.OUTPUT}),
pulseWidth = 1850,
increment = -100;
// Valor de puerta cerrada 1850
// Valor de puerta abierta 560
// La amplitud de apertura es 1290
// Tiempo para la apertura: 10s
var motor = new Gpio(13, {mode: Gpio.OUTPUT});
var pulseWidth = 1850;
var increment = -129;
var test = setInterval(function () {
motor.servoWrite(pulseWidth);
......@@ -24,9 +27,9 @@ var test = setInterval(function () {
pulseWidth += increment;
if (pulseWidth >= 1850) {
increment = -100;
increment = -129;
} else if (pulseWidth <= 550) {
increment = 100;
increment = 129;
}
}, 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