rpio2
Version:
Control Raspberry Pi GPIO pins with node.js. Fast and easy to use.
18 lines (13 loc) • 317 B
JavaScript
const Gpio = require('../lib/index.js').Gpio;
const gpio = new Gpio(40);
gpio.open(Gpio.OUTPUT);
void function loop(){
Promise.resolve(gpio.toggle())
.then(gpio.sleep.bind(null, 500, true))
.then(loop)
}();
process.on("SIGINT", function(){
gpio.close();
console.log('shutdown!');
process.exit(0);
});