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