#Picaxe 20M2
Symbol lastTime = w0
Symbol time1 = w1
Symbol time2 = w2
MainLoop:
Do
Gosub UpdateTimers
If time1 >= 1 Then
time1 = 0
Toggle B.1
End If
If time2 >= 2 Then
time2 = 0
Toggle B.2
End If
Loop
UpdateTimers:
Do While time <> lastTime
inc lastTime
inc time1
inc time2
Loop
Return
#Picaxe 20M2
Symbol lastTime = w10
Symbol time1 = w11
Symbol time2 = w12
Start0:
Do
Gosub UpdateTimers
Loop
Start1:
Do
If time1 >= 1 Then
time1 = 0
Toggle B.1
End If
Loop
Start2:
Do
If time2 >= 2 Then
time2 = 0
Toggle B.2
End If
Loop
UpdateTimers:
Do while time <> lastTime
inc lastTime
inc time1
inc time2
Loop
Return
Time1Event = 10
Time2Event = 15
Time = 0
do
if time >= Time1Event then
do something
Time1Event = time + 10 ; or $FFFF to turn off
endif
if time >= Time2Event then ; do something else
...
endif
if time >= 43200 then ' half a day, 12 hours, 60*60*12
if time1Event <> $ffff then
time1Event = time1Event - time ' remaining time to event--may wish to confirm that time1Event not < time
endif
if time2Event <> $ffff then
time2Event = time2Event - time ' remaining time to event2
endif
time = 0 ' reset for another 12 hours
endif
loop