servo test

parent 9ff5319e
Showing with 6 additions and 4 deletions
......@@ -23,14 +23,14 @@ function abrirPuerta(){
var increment = -10;
var intervaloApertura = setInterval(function () {
var intervalo = setInterval(function () {
motor.servoWrite(pulseWidth);
pulseWidth += increment;
if (pulseWidth <= 950) {
clearInterval(intervaloApertura);
clearInterval(intervalo);
}
}, 100);
......@@ -41,21 +41,23 @@ function cerrarPuerta(){
var increment = 10;
var intervaloApertura = setInterval(function () {
var intervalo = setInterval(function () {
motor.servoWrite(pulseWidth);
pulseWidth += increment;
if (pulseWidth >= 1850) {
clearInterval(intervaloApertura);
clearInterval(intervalo);
}
}, 100);
}
abrirPuerta();
console.log("Fin 1");
cerrarPuerta();
console.log("Fin 2");
// Clean LEDs
//RED.pwmWrite(dutyCycle);
......
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