Add UL to at least one number: 60UL * 1000. On an Uno an int holds up to 32767 only.
What the message means
The compiler calculates with the type of the constants. Two plain ints overflow before the result is stored in a larger variable.
Fix it in this order
- Write one constant as unsigned long, such as 60UL or 1000UL.
- Declare the variable as unsigned long.
- Check intermediate results, since a big product overflows before the next division.
- Print the value to confirm it.
- On 32-bit boards such as the ESP32 the problem is much rarer.
Why it happens
On an Uno an int is 16 bits and holds at most 32767. The expression 60 * 1000 is calculated as ints, so it overflows and gives a wrong number before it is stored in a larger variable.
Add the UL suffix so the maths uses unsigned long, for example 60000UL or 60UL * 1000.
If you see this, do this
| You see | Do this |
|---|---|
| Interval is too short or negative | Overflow. Add UL. |
| Works on ESP32, fails on Uno | int size. |
Related
Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.