Node.js bindings to wiringPi
C++ JavaScript Python
Latest commit f56c91f Jul 18, 2015 @Soarez Advise using fork. fixes #4 #5
Permalink
Failed to load latest commit information.
deps What is this crap??? Dec 19, 2012
examples Add pwm example Apr 25, 2013
lib HIGH and LOW Aug 1, 2013
src Bugfixes Dec 20, 2012
.gitignore Init Dec 19, 2012
README.md Advise using fork. fixes #4 #5 Jul 18, 2015
binding.gyp Remove build bugs Dec 20, 2012
package.json bug fixes via @csquared Aug 2, 2013

README.md

UPDATE

Project now lives here: eugeneware/wiring-pi.


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:

  • 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 number
  • mode: 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 number
  • value: 0 (wpi.LOW) or 1 (wpi.HIGH)

wpi.digitalRead(pin)

wpi.digitalRead(0);
//=> 1
  • pin: pin number

Wrapped WiringPI calls:

These have the same arguments as their WiringPi counterparts

  • piBoardRev
  • pwmSetRange
  • pwmSetClock
  • pwmWrite