Go Down

Topic: Test time? (Read 456 times) previous topic - next topic

mistergreen

This is more of a conceptual question.

Background:
I have a web interface to set timed events to devices. The arduino calls a RTC every minute to check up on the time to trigger appropriately.

Now, I would like to create a 'test' mode where you set set the time to whatever and the speed of the time like x10 speed, so a minute will only take 6 seconds. This is you don't have to wait an hour to see your device in action.

How would I go about this? Obviously, the test time is not relegated to the RTC anymore but I have a feeling this test mode is too complex.

Henry_Best

In test mode you get the RTC time once and store it in a variable. Every 6000 milliseconds (6 seconds) increase the time variable by one minute. Use the time variable instead of the RTC to run your sketch in test mode. It shouldn't be too difficult.

mistergreen

Yeah that part is easy. What about the timed event logic that looks at the rtc?  I'd have to tell it to look at the test mode time instead. hmmm. Maybe it isn't as complicated after all.

Robin2

If you build a "break" into your logic it may make things easier.

What I have in mind is that the normal reading of the RTC stores the reading in a variable. The rest of the program uses that variable as a proxy for the clock. Then in test mode you just need a little bit of code to artificially put values in that variable and all of the rest of the program runs as normal in complete ignorance of the false time values.

...R

Henry_Best


If you build a "break" into your logic it may make things easier.

What I have in mind is that the normal reading of the RTC stores the reading in a variable. The rest of the program uses that variable as a proxy for the clock. Then in test mode you just need a little bit of code to artificially put values in that variable and all of the rest of the program runs as normal in complete ignorance of the false time values.

...R


That's what I meant, but you explained it better.

Go Up