servo test

parent bbbb810c
Showing with 15 additions and 3 deletions
...@@ -21,7 +21,19 @@ var motor = new Gpio(13, {mode: Gpio.OUTPUT}); ...@@ -21,7 +21,19 @@ var motor = new Gpio(13, {mode: Gpio.OUTPUT});
var pulseWidth = 1850; var pulseWidth = 1850;
var increment = -10; var increment = -10;
var test = setInterval(function () {
for(var i=0;i<90;i++){
setTimeout(function(){
pulseWidth += -10;
}, 100);
if(pulseWidth > 950){
console.log("Fuera de rango en apertura");
break;
}
}
/*var test = setInterval(function () {
motor.servoWrite(pulseWidth); motor.servoWrite(pulseWidth);
pulseWidth += increment; pulseWidth += increment;
...@@ -32,7 +44,7 @@ var test = setInterval(function () { ...@@ -32,7 +44,7 @@ var test = setInterval(function () {
increment = 10; increment = 10;
} }
}, 100); }, 100);*/
// Clean LEDs // Clean LEDs
//RED.pwmWrite(dutyCycle); //RED.pwmWrite(dutyCycle);
...@@ -45,7 +57,7 @@ var test = setInterval(function () { ...@@ -45,7 +57,7 @@ var test = setInterval(function () {
*/ */
app.use('/public', express.static(__dirname + '/public')); app.use('/public', express.static(__dirname + '/public'));
app.get('/', function(req, res) { app.get('/', function(req, res) {
res.sendFile(__dirname + '/views/index.html'); res.sendFile(__dirname + '/public/views/index.html');
}); });
server.listen('8080'); server.listen('8080');
......
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