Pages: [1]   Go Down
Author Topic: Test time?  (Read 389 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 8
Posts: 291
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

London
Offline Offline
Edison Member
*
Karma: 46
Posts: 1368
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Sr. Member
****
Karma: 8
Posts: 291
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

UK
Offline Offline
Faraday Member
**
Karma: 101
Posts: 6244
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

London
Offline Offline
Edison Member
*
Karma: 46
Posts: 1368
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: