const unsigned long SECOND = 1000;
const unsigned long HOUR = 3600*SECOND;
const unsigned int minuto = SECOND*60;
const unsigned int hora = minuto*60;
horas = 2UL * HOUR;
for(unsigned long h=horas;h>0;h-=1000)
delay(1000);
delay(2UL*HOUR); Not working, delay only 7 minutes
Please don't hijack threads @lercio. I have split your post out to its own topic.
Hijacking is against the Arduino forum rules. The reason is that it may sidetrack the discussion, even preventing the creator of the topic from getting the assistance they need. It also reduces your own chances of getting assistance.
const unsigned long SECOND = 1000;
//const unsigned long HOUR = 3600 * SECOND; // NOT 3600SECOND
//const unsigned int minuto = SECOND * 60; // NOT SECOND60
const unsigned long HOUR = 3600SECOND;
const unsigned int minuto = SECOND60; /
const unsigned int hora = minuto * 60;
unsigned long horas = 2UL * HOUR;
does not even compile because
3600SECOND;
and
SECOND60
are not defined.
So there is a chance that the actual compilation aborted and not uploaded to the arduino
but instead
a former version of your code is running
If this is corrected like in this code
shown in the wokwi-simulation
it works as expected
unsigned long deltaT = 10006032; // 32 minutes in ms
it feels wrong but If I add the code tags
unsigned long deltaT = 1000*60*32; // 32 minutes in ms
suddenly the mystery is solved
that's why we insist on using code tags. a star introduce the italic text mode otherwise, a double star the bold text mode (we also used to have issues with previous tags like [i] or [x] that were interpreted to format the text)
Back to the original question, does anyone see the calculation overflow (hora) in the post? And the redefined variable (horas)? Is the OP still with us?