Skip to content

Instantly share code, notes, and snippets.

@companje
Created March 7, 2024 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save companje/954ee3647bd1f0be3880edb57c609692 to your computer and use it in GitHub Desktop.
Save companje/954ee3647bd1f0be3880edb57c609692 to your computer and use it in GitHub Desktop.
RGBW LEDs with Arduino
#include <Adafruit_NeoPixel.h>
#define LED_PIN 3
#define LED_COUNT 163
#define DELAYVAL 25
int i=0;
Adafruit_NeoPixel pixels(LED_COUNT, LED_PIN, NEO_GRBW + NEO_KHZ800);
void setup() {
pixels.begin();
}
void loop() {
pixels.clear();
for (int j=0; j<10; j++) {
int index = (i+j) % LED_COUNT;
pixels.setPixelColor(index, pixels.Color(0, 0, 0, 255));
}
pixels.show();
delay(DELAYVAL);
if (++i>=LED_COUNT) i=0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment