Do you have any external form of time standard available or are you going to rely on the not very accurate Arduino oscillator to provide the timing ?
If absolutely nothing else is going on in the program you could simply put a huge delay() in the in the loop() function but a smarter way would be to use the BlinkWithoutDelay principle as shown in the example with that name in the IDE.
Either way the code that you posted should be in a function called at the appropriate time from the loop() function.
Please post the whole program as it is in order to get help in the context of the program.
The problem we're having is that battery detection needs to happen first so when the battery is low, it closes the valve and alerts the user but we need to allow a 24 hour period for the valve to open back up but have been unable to because of the statement telling the system to close the valve when the battery is low.
We're using the 'DS1307RTC' and 'Time' libraries.
I'm not opposed to using the delay method but I can't see a way to use that only once after the battery low condition has been detected.
I could make another void function but it would still need to be run system wide so that the battery condition can be checked.
This is why I wanted to make a loop that checks to see if it has run a certain statement or function already and won't allow it to run again until 24 hours have passed.
I suggest that you post the whole of the program so that advice can be given in the proper context.
As you are using an RTC there delay method, which is a kludge at the best of times, is not appropriate. The RTC will provide a mechanism for timing 24 hours.
I wanted to make a loop that checks to see if it has run a certain statement or function already and won't allow it to run again until 24 hours have passed.
You already have the loop() function so you don't need another loop. When the function has run set a flag variable to true to denote the fact then don't run the function again for 24 hours if the flag is set.
UKHeliBob:
You already have the loop() function so you don't need another loop. When the function has run set a flag variable to true to denote the fact then don't run the function again for 24 hours if the flag is set.
That's exactly what we need to do. Would you know the code to do that?
Would you know how to do that with the 'Time' library? 24 hours in milliseconds is a lot of numbers! I should also mention that we're working with a custom board but we're using the arduino micro-controller and IDE to load sketches.