Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
/ rpi Public archive
forked from xseignard/rpi

Yet another Node.js library to use the Raspberry Pi GPIOs.

Notifications You must be signed in to change notification settings

418sec/rpi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rpi Build Status

Yet another Node.js library to use the Raspberry Pi GPIOs.

Relies on WiringPi and then has some nice features:

  • no sudo required
  • you can use the GPIOs from the P5 header of the Pi
  • based on Event Emitters

It's a WIP! But basic read and write should work. See the examples folder.

API

GPIO()

GPIO class, that represents an instance of a GPIO.

Pin numbers are the ones used in wiringPi. Specify the pin direction with 'in' or 'out'.

If the pin direction is 'in', events 'change', 'rise' and 'fall' will be fired when needed.

Here is a quick sample:

var pin8 = new GPIO(8, 'in');
pin8.on('ready', function() {
	console.log('ready');
});
pin8.on('rise', function() {
	console.log('rise');
});
pin8.on('change', function(value) {
	console.log(value);
});

GPIO.write(value:Number, callback:function())

Write the value on the GPIO

GPIO.high(callback:function())

Shorthand for pin.write(1, callback). Writes 1 on the GPIO

GPIO.low(callback:function())

Shorthand for pin.write(0, callback). Writes 0 on the GPIO

GPIO.read(callback:function())

Reads the value on the GPIO

About

Yet another Node.js library to use the Raspberry Pi GPIOs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 92.2%
  • Makefile 7.8%