Hello everybody,
By reading multiples articles on this forum, I've just wrote some test code for a Countdown Timer, to run on a 08m2+, It's working fine,
I'm concern about, if there's a way to simplify the codes, making it shorter or faster.
Thank's to all for the good work.
==================================================================================================
By reading multiples articles on this forum, I've just wrote some test code for a Countdown Timer, to run on a 08m2+, It's working fine,
I'm concern about, if there's a way to simplify the codes, making it shorter or faster.
Thank's to all for the good work.
Code:
=============================================
;countdown timer Jul-18-2020
;countdown var.
SYMBOL secs = b0
SYMBOL mins = b1
SYMBOL hours = b2
;leading "0" var.
SYMBOL secs1 = b3
SYMBOL mins1 = b4
SYMBOL hours1 = b5
;start countdown 00:01:10 HH:M:SS
b2=0:b1=1:b0=10
Main:
hours1="":mins1="":secs1="" ;leading "0" if needed
if secs<10 then
secs1="0"
endif
if mins<10 then
mins1="0"
endif
if hours<10 then
hours1="0"
endif
;send format HH:MM:SS
serout 0,N2400,(hours1,#hours,":",mins1,#mins,":",secs1,#secs,cr,lf)
if secs=0 and mins=0 and hours=0 then
end
endif
if mins=0 and hours >0 then ;hours
dec hours
mins=59
goto main
endif
if secs=0 and mins >0 then ;minutes
dec mins
secs=59
goto main
endif
if secs >0 then ;seconds
dec secs
endif
Goto Main
Last edited: