I'm facing an error with millis() function. When the code starts everything works fine then after 1 hour the millis function fails.
Below is my code
long cur_millis,prev_millis;
cur_millis=millis(); prev_millis=millis(); while(cur_millis-prev_millis<30000) { take_photo(); digitalWrite(25,HIGH); upload_photo(); cur_millis=millis(); }
digitalWrite(25,LOW);
In this code the while condition becomes always true after 1 hour and working as infinite loop.
Please help me fix this problem.
but how could it overflow in 1 hour.
for 1 hour 15 minutes the value of millis will be 4500000