0.1.1 • Published 4 years ago
pigpio-components-reversed v0.1.1
pigpio-components
Based on the pigpio-components package.
Brightness level reversed (if you used pigpio-components and off was on, on was off, this module might be useful for you). Brightness control added. Minor improvements.
Default brightness is 50% (Be warned that setting up brightness to 100% is not recomended for some LEDs).
Setup
npm install pigpio-components-reversed
Examples
This example assumes a pullup button connected to GPIO24, RGB LED connected to GPIO12, GPIO13 and GPIO18, Mono color LED connected to GPIO19.
const { Button, RGBLed, Led } = require("pigpio-components-reversed");
const rgbLed = new RGBLed({
red: 12,
green: 13,
blue: 18
});
const ledWhite = new Led(19);
const button = new Button({ gpio: 24, isPullup: true });
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(); //Pulse method is changed
rgbLed.stop();
rgbLed.brightness("0.7"); // From 0 to 1
ledWhite.on();
ledWhite.off();
ledWhite.pulse();
ledWhite.stop();
ledWhite.brightness("0.3");
API
Read the source.