Raspberry Pi GPIO communication on top of WiringPi
Yet another Node.js library to use the Raspberry Pi GPIOs.
Relies on WiringPi and then has some nice features:
- no sudo required
- you can use the GPIOs from the P5 header of the Pi
- based on Event Emitters
It's a WIP! But basic read and write should work. See the
GPIO class, that represents an instance of a GPIO.
Pin numbers are the ones used in wiringPi. Specify the pin direction with 'in' or 'out'.
If the pin direction is 'in', events 'change', 'rise' and 'fall' will be fired when needed.
Here is a quick sample:
var pin8 = 8 'in';pin8on'ready'console.log'ready';;pin8on'rise'console.log'rise';;pin8on'change'console.logvalue;;
Write the value on the GPIO
Shorthand for pin.write(1, callback). Writes 1 on the GPIO
Shorthand for pin.write(0, callback). Writes 0 on the GPIO
Reads the value on the GPIO