#include NS_Rainbow ns_stick2 = NS_Rainbow(8,2); void setup() { pinMode(13, OUTPUT); ns_stick2.begin(); Serial.begin(115200); } void loop() { while (Serial.available()) { String s1 = Serial.readStringUntil(':'); String s2 = Serial.readStringUntil(';'); process_event(s1, s2); } delay(10); } void process_event(String s1, String s2) { if (s1 == "LED" && s2 == "on") { digitalWrite(13, HIGH); ns_stick2.setAllColor(150, 150, 150); ns_stick2.show(); } if (s1 == "LED" && s2 == "off") { digitalWrite(13, LOW); ns_stick2.setAllColor(0, 0, 0); ns_stick2.show(); } if (s1 == "brightness") { int b = s2.toInt(); int c = map(b, 0, 100, 0, 255); ns_stick2.clear(); ns_stick2.setAllColor(c, c, c); ns_stick2.show(); } }