i'm using the following section of code in a timer:
if (SetLastNumber == false) // if false Lastnumber = EEPROM Value
{
SetLastNumber = true;
//Last Number = EEPROM Value
}
else //Else LastNumber= 0
{
//Last Number=0
}
if (ReadActivationStartTime == false) //set millis starttime. read every time timer activates set to false at timer end to enable millis starttime set once per iteration
{
ReadActivationStartTime = true;
StartTime = millis();
}
//do rest of timer code
So What i have done is use booleans to read EEPROM value once and after the first count period it is true and as such Last number will be 0. And then i have used boolians again for the start time to ensure that it to would only be read once per iteration.
My problem is that it is messy and i think to complicated. is there a better way that someone can suggest to use so that eeprom value is used once to measure the elapsed time then is set to 0, and or a better way to have the start time of my timer read only once?
I removed alot of the code to make seeing my problem easier and left comments instead to see what each part does individually.
thanks for the suggestions in advance.