Clock problems
Archiver
Posts: 46,084
Hello,
I used the code below to create a count-down timer and it worked well.
Except, once I hit a key on the keyboard, it stopped and I had to
restart the whole thing. I'm a novice and have been trying to put in a
command that basically says if "space bar" is pressed, then stop
clock. If clock is stopped and "space bar" is pressed, then start the
clock.
I've also tried to set a command to press a button (like one of the
function keys) to allow me to set the clock.
Thanks for any help in advance.
Jarrod.
'{$STAMP BS2}
BS CON $08
minutes VAR BYTE
seconds VAR BYTE
pc_byte VAR BYTE
minutes = 2: seconds = 10
DEBUG DEC2 minutes,":",DEC2 seconds
loop:
SERIN 16,16468,1000,timeout,[noparse][[/noparse]pc_byte]
DEBUG BS, pc_byte
' insert keyboard pressed logic here
timeout:
minutes = minutes - (60 - seconds / 60)
seconds = 59 - seconds / 59 * 60 + seconds - 1
DEBUG BS,BS,BS,BS,BS,DEC2 minutes,":",DEC2 seconds
IF seconds + minutes > 0 THEN loop
DEBUG CR "timer expired"
' insert timer expired logic here
For all of your corporate events, dances, sporting events, parties and
more, call upon Jarrod to make your event the best it can be! For more
information on booking your next event through SportsAnnouncing.com,
simply reply to this message!
I used the code below to create a count-down timer and it worked well.
Except, once I hit a key on the keyboard, it stopped and I had to
restart the whole thing. I'm a novice and have been trying to put in a
command that basically says if "space bar" is pressed, then stop
clock. If clock is stopped and "space bar" is pressed, then start the
clock.
I've also tried to set a command to press a button (like one of the
function keys) to allow me to set the clock.
Thanks for any help in advance.
Jarrod.
'{$STAMP BS2}
BS CON $08
minutes VAR BYTE
seconds VAR BYTE
pc_byte VAR BYTE
minutes = 2: seconds = 10
DEBUG DEC2 minutes,":",DEC2 seconds
loop:
SERIN 16,16468,1000,timeout,[noparse][[/noparse]pc_byte]
DEBUG BS, pc_byte
' insert keyboard pressed logic here
timeout:
minutes = minutes - (60 - seconds / 60)
seconds = 59 - seconds / 59 * 60 + seconds - 1
DEBUG BS,BS,BS,BS,BS,DEC2 minutes,":",DEC2 seconds
IF seconds + minutes > 0 THEN loop
DEBUG CR "timer expired"
' insert timer expired logic here
For all of your corporate events, dances, sporting events, parties and
more, call upon Jarrod to make your event the best it can be! For more
information on booking your next event through SportsAnnouncing.com,
simply reply to this message!
Comments
I used the code below to create a count-down timer and it worked well.
Except, once I hit a key on the keyboard, it stopped and I had to
restart the whole thing. I'm a novice and have been trying to put in a
command that basically says if "space bar" is pressed, then stop
clock. If clock is stopped and "space bar" is pressed, then start the
clock.
I've also tried to set a command to press a button (like one of the
function keys) to allow me to set the clock.
Thanks for any help in advance.
Jarrod.
'{$STAMP BS2}
BS CON $08
minutes VAR BYTE
seconds VAR BYTE
pc_byte VAR BYTE
minutes = 2: seconds = 10
DEBUG DEC2 minutes,":",DEC2 seconds
loop:
SERIN 16,16468,1000,timeout,[noparse][[/noparse]pc_byte]
DEBUG BS, pc_byte
' insert keyboard pressed logic here
timeout:
minutes = minutes - (60 - seconds / 60)
seconds = 59 - seconds / 59 * 60 + seconds - 1
DEBUG BS,BS,BS,BS,BS,DEC2 minutes,":",DEC2 seconds
IF seconds + minutes > 0 THEN loop
DEBUG CR "timer expired"
' insert timer expired logic here
For all of your corporate events, dances, sporting events, parties and
more, call upon Jarrod to make your event the best it can be! For more
information on booking your next event through SportsAnnouncing.com,
simply reply to this message!