#include #define PIN D3 // Change this pin to the one you're using for DIN #define NUMPIXELS 8 // Change this based on how many LEDs you have Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); void setup() { Serial.begin(9600); pixels.begin(); pixels.clear(); pixels.show(); } void loop() { if (Serial.available()) { char c = Serial.read(); uint32_t color; switch (c) { case 'r': color = pixels.Color(255, 0, 0); // red break; case 'b': color = pixels.Color(0, 0, 255); // blue break; case 'y': color = pixels.Color(255, 255, 0); // yellow break; case 'x': // random color = pixels.Color(random(0, 255), random(0, 255), random(0, 255)); break; default: return; } for (int i = 0; i < NUMPIXELS; i++) { pixels.setPixelColor(i, color); } pixels.show(); } }