I am looking for the code or library that will allow me to start a timer that will time how long a test is true. For example, I want a timer to start and continue to run as long as the voltage < voltageValue in the first 'if' statement in the code below. Does anyone have any ideas how to do this?
Previously I have tried to do this with the millis(), but since my project will be running for hours at a time, with the voltages changing at irregular intervals, the numbers that the board will have to store will become extremely large. Is there some other way to do what I want to do?
note: start Timing (t); is just a place holder. This is where I want my timer to begin timing.
if (voltage<voltageValue){
start Timing (t);
if ((voltage < voltageValue) && (t > Tup)) // has been up for more than 30 seconds
{
stop Timing (t);
Action = 0;
goto Reset; // Reset
}
else if ((voltage > voltageValue) && (t < Tup)) // has sat down before 30 seconds
{
stop Timing (t);
Tdown = t * 30; // changes up time to new value
goto beginning ; //goes to 'beginning' of do loop
}
}