Okay, so I want to make a program that every second increases a value, and after 86400 seconds (24h) I want the chip to print in the serial port "Time is over!!!". Up to now it sounds like a project for beginners. BUT we all know that everything resets when there is no power. The chip would be restarted around 50 times for all these 24h. Of course I know that the chip won't be counting while off but I need it to run for total of 24h while active, it doesn't matter for how long it would be off.
What I want is after every second and consequently after every variable increment by 1 the variable to be written somewhere in the chip (lets say ROM if there is such a memory) so it won't be erased when power is off and upon every new restart of the chip in the void setup() function to be read again and assigned to the variable.
The code should look like this:
unsigned long clock = 0; //clock is our variable
void setup(){
Serial.begin(9600);
clock = [b]AND HERE GOES THE NUMBER STORED IN THE ROM[/b];
}
void loop{
clock++;
[b]AND HERE THE VARIABLE IS SAVED IN THE ROM[/b];
delay(1000);
if(clock == 84600){
Serial.print("Time is over!!!");
clock = 0;
}
}