soarez / node-wiring-pi

Node.js bindings to wiringPi
86 stars 128 forks source link

UPDATE

Project now lives here: WiringPi/WiringPi-Node.


Node.js bindings to WiringPi

Install

> npm install wiring-pi

Use


var wpi = require('wiring-pi');

wpi.setup([mode])

wpi.setup();
wpi.setup('gpio');

Valid Modes:

See WiringPi Pins for the differences in Pin numbering;

wpi.pinMode(pin, mode)

wpi.pinMode(0, wpi.modes.OUTPUT);

wpi.digitalWrite(pin, value)

wpi.digitalWrite(0, wpi.HIGH);
wpi.digitalWrite(0, wpi.LOW);

wpi.digitalRead(pin)

wpi.digitalRead(0);
//=> 1

Wrapped WiringPI calls:

These have the same arguments as their WiringPi counterparts