Does anyone know what size value is able to be handled in the argument

Does anyone know what size value is able to be handled in the argument for EVERY_N_SECONDS? For instance, can I pass it 1,000s or 10k+ to use for it for (rough) timing over hours?

You can also use EVERY_N_MINUTES and EVERY_N_HOURS, as well as EVERY_N_MILLISECONDS

IIRC, the value is a 16-bit unsigned value, so 1…65535 for SECONDS and MINUTES. 8-bit for HOURS, and 32-bit for MILLISECONDS.

See lib8tion.h for how it works. https://github.com/FastLED/FastLED/blob/master/lib8tion.h

Ah brilliant! Thanks. Not sure how I didn’t catch the minutes and hours versions.

Also note that all this timing is WILDLY approximate! Like… plus or minus 10% in the worst cases.
If you need real time measurement, nothing beats a real-time clock chip, except maybe an internet connection and an NTP client.

I’m using both on this project! Using the Photon’s RTC for specific triggers and the EVERY_N_* for some changes in LED sequencing in between.

Hello @Mark_Kriegsman ,

I’d be grateful if you could provide an example of using an external time source (e.g. rtc) as a reference instead of the internal millis.

I gather it relies on the “get_millisecond_timer” function. I just don’t seem to understand how to convert the rtc’s elapsing seconds into some meaningful millis-equivalent.

Any help greatly appreciated!

@matt_p You know, I don’t have a good working example of that, but it’s something that I could put together. Thanks for the suggestion; I’d use it myself if I had it!

Hmmm - thinking about a program where something would be called every 7.48 years…

@Mark_Kriegsman Is there any reason why EVERY_N_MILLISECONDS() wouldn’t accept an integer variable? i.e. I’m trying EVERY_N_MILLISECONDS(setDelay){ [code] }. This doesn’t seem to work, but when I place the actual value that setDelay is set to in its place then it works.

I’m an idiot. I was using too small an integer declaration. Ignore me.