UNPKG

rpio2

Version:

Control Raspberry Pi GPIO pins with node.js. Fast and easy to use.

19 lines (13 loc) 333 B
const wait = require('wait-promise'); const Gpio = require('../lib/index.js').Gpio; var gpio = new Gpio(40); gpio.open(Gpio.OUTPUT); wait.every(500).and(function(){ //forever - never return true gpio.toggle(); }).forward(); process.on("SIGINT", function(){ gpio.close(); console.log('shutdown!'); process.exit(0); });