r/FastLED • u/d333gs • Feb 13 '25
Support delay(); not working as a replacement for FastLED.delay();
I am using an Arduino Mega to controle 1535 LEDs. I am using 71% of the Arduino's capacity. My problem arises when I try to get a delay of 10...... 'FastLED.delay(10); '
It will only delay equal to FastLED.delay(30); which is too slow . So I tried to use just delay(10); and absolutely nothing happens.
PS, When I use the same code with 1024 LEDs I have no problem with FastLED.delay(10);
Any ideas out there would be highly appreciated!!!!
3
Upvotes
4
u/Marmilicious [Marc Miller] Feb 13 '25
FastLED.delay() continuously calls FastLED.show() under the hood for the amount of time specified, and then the program continues. Using the normal delay() completely stops everything for the specified time.
Depending what you're trying to achieve it might be better to use EVERY_N_MILLISECONDS to do your timing.
Feel free to share a link to your code on pastebin.com or gist.github.com for further suggestions.
11
u/johnny5canuck Feb 13 '25
I would rather walk on glass than use delay.
My preference these days is to use millis(), and this link is a good way to learn that:
https://docs.arduino.cc/built-in-examples/digital/BlinkWithoutDelay/
There's also FastLED's EVERY_N_MILLIS() function.
Anything but delay().
1
u/d333gs Feb 14 '25 edited Feb 14 '25
Thanks for the response everybody, here is the code https://gist.github.com/d333gs/81aad939567814e706899e38c4b032a6
EVERY_N_MILLIS and variations not working!
Video link to LEDs https://youtube.com/shorts/wpNVCZiJkFo?feature=share
1
u/likelikegreen72 Feb 14 '25
Fast led relies on continuous execution.. delay will break it. Use millis