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