I did already some Ardunio projects, though I am not a hardcore programmer.
Yesterday I discovered an interesting effect which I thought of posting here as this might
occur to more people, I guess.
My code was like this:
unsigned long T0; // Time stamp
unsigned long Rest_L; // remaining time in min
unsigned long Dauer; // Duration
i
void loop(void) {
...
T0 = millis(); // is set when special condition occurs and used as reference for calculation later
.....
Rest_L= ((T0+(60601000) - millis() )/60000); //calculate remaining time in minutes
This didn't work out.
Then I tried to get closer to the problem and isolated this:
Dauer = 60603600;
printed then Dauer to the serial monitor.
And it was't 3600000 to my surprise.
Then I substituted the "60601000" by 3600000 in my comparison equation and it worked.
Rest_L= ((T0+3600000 - millis() )/60000); //calculate remaining time in minutes
I find this behaviour a bit surprising, but probably harcore programmers will laugh.
Nevertheless several newbies might fall into the same trap.
So I thought it might be useful to post it.
Cheers, Peter