Project now lives here: WiringPi/WiringPi-Node.
Node.js bindings to WiringPi
> npm install wiring-pi
var wpi = require('wiring-pi');
wpi.setup([mode])
wpi.setup();
wpi.setup('gpio');
Valid Modes:
wpi
: sets up pin numbering with wiringPiSetup
gpio
: sets up pin numbers with wiringPiSetupGpio
sys
: sets up pin numbers with wiringPiSetupSys
See WiringPi Pins for the differences in Pin numbering;
wpi.pinMode(pin, mode)
wpi.pinMode(0, wpi.modes.OUTPUT);
pin
: pin numbermode
: wpi.modes.INPUT
, wpi.modes.OUTPUT
, or wpi.modes.PWM_OUTPUT
wpi.digitalWrite(pin, value)
wpi.digitalWrite(0, wpi.HIGH);
wpi.digitalWrite(0, wpi.LOW);
pin
: pin numbervalue
: 0 (wpi.LOW
) or 1 (wpi.HIGH
)wpi.digitalRead(pin)
wpi.digitalRead(0);
//=> 1
pin
: pin numberThese have the same arguments as their WiringPi counterparts
piBoardRev
pwmSetRange
pwmSetClock
pwmWrite