我已经研究了一段时间,没有发现任何结论。
我想在我的Raspberry pi上使用可寻址的LED,可能与node.js(npm gpio)或python一起使用。我对电路不是很了解,但是我觉得树莓派没有数字写功能。
该板具有4个输入(5v,SDI,CKI,GND)
我正在使用这个:http://www.amazon.com/gp/product/B008F05N54/ref=oh_details_o01_s00_i00?ie=UTF8&psc=1
这是我可以使用的单个LED的功能,但对于灯条却不可用:
var gpio = require("gpio");
var gpio22, gpio4, intervalTimer;
// Flashing lights if LED connected to GPIO22
gpio22 = gpio.export(22, {
ready: function() {
inervalTimer = setInterval(function() {
gpio22.set();
setTimeout(function() { gpio22.reset(); }, 500);
}, 1000);
}
});
// Lets assume a different LED is hooked up to pin 4, the following code
// will make that LED blink inversely with LED from pin 22
gpio4 = gpio.export(4, {
ready: function() {
// bind to gpio22's change event
gpio22.on("change", function(val) {
gpio4.set(1 - val); // set gpio4 to the opposite value
});
}
});
// reset the headers and unexport after 10 seconds
setTimeout(function() {
clearInterval(intervalTimer); // stops the voltage cycling
gpio22.removeAllListeners('change'); // unbinds change event
gpio22.reset(); // sets header to low
gpio22.unexport(); // unexport the header
gpio4.reset();
gpio4.unexport(function() {
// unexport takes a callback which gets fired as soon as unexporting is done
process.exit(); // exits your node program
});
}, 10000)
我想做的就是让它与我的可寻址LED灯条配合使用:
有人知道我是否可以通过数字写入与可寻址LED一起工作吗?我要错了吗?
谢谢!!我对此感到困惑。
最佳答案
看一下本教程。尽管我不完全了解试纸条的工作方式,但我设法使用此代码使我的Pi以某种随机方式与我的Pi一起工作,但试纸条不是由同一家制造商生产的。我发现使用Arduino编写测试条要容易得多。另外,在Make杂志中也有一些很棒的教程,介绍了如何使用Adafruit的LED灯条和面板。
https://learn.adafruit.com/light-painting-with-raspberry-pi/overview
干杯
史蒂夫