You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#include <WS2812.h>
#include <DigiCDC.h>
#define LEDCount 37
#define outputPin 1
WS2812 LED(LEDCount); cRGB value;
void setup() { SerialUSB.begin(); LED.setOutput(outputPin); }
void loop() { if (SerialUSB.available() > 1 && SerialUSB.read() == 0x10) { byte command = SerialUSB.read(); if (command == 0x11) { LED.sync(); SerialUSB.write(0x1f); } else if (command == 0x12) { while (SerialUSB.available() < 4) { } int pos = SerialUSB.read(); value.r = SerialUSB.read(); value.g = SerialUSB.read(); value.b = SerialUSB.read(); LED.set_crgb_at(pos, value); SerialUSB.write(0x1f); } else { SerialUSB.write(0x1e); } SerialUSB.flush(); } }
|