PAUSE limitations
adamlighting
Posts: 6
I need to control two relays 8 hours apart. The max I can tell a PAUSE command to do is 56k or so.
Would it be possible to string together PAUSE commands to get me 8 hours?
For example:
PAUSE 60000
PAUSE 60000
PAUSE 60000
PAUSE 60000
repeat this until there are 480 PAUSE commands.
·
Would it be possible to string together PAUSE commands to get me 8 hours?
For example:
PAUSE 60000
PAUSE 60000
PAUSE 60000
PAUSE 60000
repeat this until there are 480 PAUSE commands.
·
Comments
timer:
i=i+1
pause 1000
if i=28800 then timeout
else timer
timeout:
i=0 'to reset timer
'what you want to do here
If you want to be able to use the Stamp for something else while waiting for 8 hours to elapse, make the subroutine much shorter, say 10 seconds and increase the number of loops accordingly. Note that doing a timing in this fashion is not very accurate.
If accuracy is needed, nothing beats a clock.
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
Here's my application. Maybe I only need one relay. I just will turn the relay on and off.
I will control a relay to turn lights on for 8 hours and off for 8 hours continuously.
With the timeout command mentioned above, won't that just reset everything. Sorry. It's been a few months since I've used my stamp.
Any code examples would be extremely helpful at this point.
' {$STAMP BS2}
DIR2 = 1····························· ' pin 2 in output mode
OUT2 = 0···························· ' pin 2 output driver low dark for first 8 hrs, change to OUT2 = 1 for light for first 8 hrs
i VAR Word
timer:
·i = i+1
PAUSE 1000
IF i=28800 THEN timeout
·else
GOTO timer
timeout:
i=0 'to reset timer
TOGGLE 2 'this would toggle pin 2 every 8 hours
GOTO timer 'this tells it to go back to timing after toggling pin 2
Post Edited (kf4ixm) : 3/11/2010 3:24:23 PM GMT