With the BlynkTimer library, I noticed that some people add the L (long) character after the number as
timer.setInterval(1000L, myTimerEvent);
However, the library code is expecting already an unsigned long number
// Timer will call function ‘f’ every ‘d’ milliseconds forever
// returns the timer number (numTimer) on success or
// -1 on failure (f == NULL) or no free timers
int setInterval(unsigned long d, timer_callback f);
I know it doesn’t do any harm adding the L but, for space crunching, is really needed that extra byte?
On some platforms, int is 16-bit, so numbers like 120000 can’t be represented.
In millis, this is just a 2min interval…
If your MCU is 32-bit, you can skip this, but still keep in mind. Yes, the specifier is only in the source code, but may impact the way the code is generated.
@vshymanskyy So, is it safe to say that we should use the data type UL for the BlynkTimer library just to be in line with the data type used in the library itself? In the SimpleTimer library, the L data type was used.