Skip to content

Instantly share code, notes, and snippets.

@kchristensen
Last active August 29, 2015 14:16
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 kchristensen/25923763ccf82beb134b to your computer and use it in GitHub Desktop.
Save kchristensen/25923763ccf82beb134b to your computer and use it in GitHub Desktop.
Rainbow Knight Rider for WS2812 LEDs
void knightRider(uint8_t wait) {
uint8_t i, j, x = 1, prev = 11;
for (j = 0; j < 256; j++) {
for (i = 0; i >= -1; i = i + x) {
if (i == 255)
return;
if (i > PIXEL_COUNT)
x = -1;
strip.setPixelColor(i, Wheel(j));
strip.setPixelColor(prev, 0);
strip.show();
delay(wait);
prev = i;
j += 6;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment