Created
June 15, 2017 15:57
-
-
Save cristiandley/d78066ea86fe9062062aa20a0be1d145 to your computer and use it in GitHub Desktop.
[RASPBERRY] Gira el motor depues de encender tocar un boton
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gpio = require("pi-gpio"); | |
function despuesDelEncendido() { | |
/** | |
* Habilita la salida 11 (GPIO 11) | |
*/ | |
gpio.open(11, "output", function(err) { | |
gpio.write(11, 1, function() { | |
gpio.close(11); | |
}); | |
}); | |
} | |
function tocaBoton() { | |
/** | |
* Lee el estado de el puerto 11 setea el valor contrario | |
*/ | |
gpio.read(11, function(err, value) { | |
if(err) throw err; | |
const turn = !value; | |
setTimeout(function () { | |
}, 60000); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment