[英]Addressable LED Strip with Raspberry Pi
我已經研究了一段時間,但沒有發現任何結論。
我想在我的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
干杯
史蒂夫
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.