Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jwhendy
Last active October 7, 2018 23: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 jwhendy/8a18915f2d5658264ed98aad73d3bb2d to your computer and use it in GitHub Desktop.
Save jwhendy/8a18915f2d5658264ed98aad73d3bb2d to your computer and use it in GitHub Desktop.
How to advance leds at a set timing
// every second, we copy all LED values forward one pixel
EVERY_N_MILLISECONDS(1000)
{
for(int i=NUM_LEDS-1; i>0; i--)
{
leds[i] = leds[i-1]
}
leds[0] = CRGB(0, 0, 0)
}
// if it's been 3 seconds, we put a new light on the strip, setting the first pixel white
EVERY_N_MILLISECONDS(3000)
{
leds[0] = CRGB(255, 255, 255)
}
FastLED.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment