Skip to content

Button and RGB Led component for Pigpio Node.js library

License

Notifications You must be signed in to change notification settings

andreasdri/pigpio-components

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pigpio-components

Components for the pigpio Node.js wrapper.

Setup

npm install --save pigpio-components

Examples

This example assumes a pullup button connected to GPIO24, and an RGB LED connected to GPIO25, GPIO08 and GPIO07.

const { Button, RGBLed } = require('pigpio-components');

const button = new Button({ gpio: 24, isPullup: true });
const rgbLed = new RGBLed({ red: 25, green: 8, blue: 7 });

button.on('click', () => console.log('press and release within 500 ms'));

button.on('long press', () => console.log('press and release >= 4000 ms'));

rgbLed.color('blue').on();
rgbLed.off();
rgbLed.color('#DC143C').strobe(1000);
rgbLed.rainbow();
rgbLed.pulse();

API

Read the source for now.

Contributions are welcome.

About

Button and RGB Led component for Pigpio Node.js library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published