我制作了一个基于网络的灯光控制器,一切都运行良好。但是我在关闭其中一个装置时遇到了问题。
要关闭灯,必须在通道 17 上发送值 250 至少 5 秒。这就是棘手的地方,我该怎么做?
我正在使用来自http://www.mathertel.de/Arduino/DMXSerial.aspx的 DMXSerial 库,但它缺少文档。
这是代码的一小部分。
if(finder.find("#dmx")) { // Find out if this is a dmx string.
if(finder.findUntil("type", ",")) { // Finds the type
cmd = finder.getValue(); // Putting the value found in its variable.
if(cmd == 4) {
if(finder.findUntil("ch", ",")) {
channel = finder.getValue();
}
if(finder.findUntil("va", ",\n\r")) {
val = finder.getValue();
}
if(channel == 17 && val == 250) {
// some code here
} else {
DMXSerial.write(channel, val);
}
}
}
欢迎任何帮助。