Node.js library to control Raspberry Pi onboard LEDs
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Add reset methods. Mar 31, 2015
test Add reset methods. Mar 31, 2015
.editorconfig Initial code for rpi-leds Mar 31, 2015
.gitignore Initial code for rpi-leds Mar 31, 2015
.jshintrc Initial code for rpi-leds Mar 31, 2015
CHANGELOG.md Add reset methods. Mar 31, 2015
README.md Add reset methods. Mar 31, 2015
gulpfile.js
index.js Initial attempt at getting power led to turn on. Mar 31, 2015
package.json Add reset methods. Mar 31, 2015

README.md

rpi-leds Circle CI

Node.js library to control Raspberry Pi onboard LEDs.

Currently only tested on the Raspberry Pi 2.

Usage

Install it

npm install rpi-leds

Include it

var RpiLeds = require('rpi-leds');
var leds = new RpiLeds();

Commands

Power LED (PWR/red) is referenced with .power.

Status LED (ACT/green) is referenced with .status.

Turn on LEDs

leds.power.turnOn();
leds.status.turnOn();

Turn off LEDs

leds.power.turnOff();
leds.status.turnOff();

Activate LED heartbeats

leds.power.heartbeat();
leds.status.heartbeat();

Activate LED blinking

leds.power.blink();
leds.status.blink();

Reset LEDs to original settings

leds.power.reset();  // Set trigger to `input`
leds.status.reset(); // Set trigger to `mmc0`

leds.reset();        // Resets both LEDs

Development

Install pre-requisites

npm install -g gulp
npm install

For development, run

gulp

Testing

Uses jasmine.

Jasmine is run automatically when gulp is called.

For continuous integration, run

gulp test

# Or,

npm test

Resources

This project is based off code from:

License

MIT