fjw / node-leddriver Goto Github PK
View Code? Open in Web Editor NEWa node.js library to control a SPI led driver (p.e adafruit leddriver) with your Raspberry Pi
License: MIT License
a node.js library to control a SPI led driver (p.e adafruit leddriver) with your Raspberry Pi
License: MIT License
Would you consider a fading function?
I ask, because it would require an additional logic, another dependency and special consideration for time (which I'd still have to figure out).
My first attack path would be to use ChroMath.gradient to calculate the colors required to fade from one color to another.
This does leave me concerned about how to properly smooth over time. Each step would have to be perfectly timed to appear to be a smooth transition, is this possible with Node?
setTimeout
is not guaranteed to be run exactly at those milliseconds. We could process.nextTick()
it, but then we cannot control the speed of the fade. Additionally, sending anything to the spi-driver might actually cause a VERY tiny delay which could be introduced, throwing off the timing.
Thoughts?
First off, thanks for sharing this library!
As I need to control 9 rgb led, i'll need to hook up to 2 sets of TCL5947. Could you advice on how i can differentiate it in node?
Hi there. I'm having an issue with the driver.send() function in your library. I can't seem to call it more than twice when I run my script without getting a fatal error. Here's the error I get.
/home/pi/lightbar/node_modules/leddriver/leddriver.js:82
return spi.send(this._getRegister());
^
Error: can't send spi message
at Object.obj.send (/home/pi/lightbar/node_modules/leddriver/leddriver.js:82:28)
at null.<anonymous> (/home/pi/lightbar/leds.js:21:10)
at wrapper [as _onTimeout] (timers.js:258:14)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
And here's my code. It's very simple, I'm just trying to blink an LED. I'm sure I'm overlooking something simple but I just can't figure it out.
var LEDDRIVER = require("leddriver");
var driver = new LEDDRIVER(24, 12);
driver.pset(0, 0);
driver.send();
var i = 0;
setInterval(function() {
if (i == 0) {
driver.pset(0, 0);
driver.send();
} else {
driver.pset(0, 1);
driver.send();
}
if (i == 1) {
i = 0;
} else {
i++;
}
}, 500);
Thanks so much for any help you can provide.
This works PERFECTLY for my 24-Channel PWM (the one you purchased). However, the 12-channel PWM only has GND, VCC, V+, CI and DI (clock in, data in) whereas the 24-channel PWM has DIN, CLK, and LAT for control.
I'm struggling to figure out how to use the 12-channel (16-bit) PWM and which cables to use. Would you kindly help me figure out how to pin it out?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.