Shop OBEX P1 Docs P2 Docs Learn Events
Just Starting, Need Help — Parallax Forums

Just Starting, Need Help

ArchiverArchiver Posts: 46,084
edited 2002-11-19 14:16 in General Discussion
I just got my BS2 with BOE and need some help figuring some things
out. First off, I'm trying to create a countdown clock that runs down
from 30 seconds to 0 seconds. The display I am using right now is the
one that comes with the editor.

My questions,
How do I get the clock to remain on one line and not scroll down (this
is just something I'm thinking of putting together to create a "shot
clock")?

How can I create a count-down clock that starts at a designated time
and can be started and stopped using a key on the keyboard. I am
trying IF/THEN but that's all I know (it hasn't worked yet).

Basically, this is my statement. For this example, I have (AB:CD) as
the display (I don't know how to display this as I said earlier, I'm
looking to "pre-set" the timer.
IF A<0 THEN A=0
IF B<0 THEN B=9
IF B<0 THEN A-1
IF C<0 THEN C=5
IF C<0 THEN B-1
IF D<0 THEN D=9
IF D<0 THEN C-1

I'm using the second B/C/D <0 to make the preceeding digit go down or
return to the right number for the timer.

Also, (stupid question alert) how do I connect a seven-segment LED to
the BS2 BOE to create a digital counter. I'm working on the scoreboard
idea of creating a score board. First off, I want to create one so
that I can create a counter from 0 to 9. When I can get the clock
documentation to work and add a few counters, I want to create a
basketball scoreboard (timer with five counters--ranging from 0-9, 0-99
and 0-999--for score, period and fouls...my next board would include
slots for bonus and possesion with a regular LED).

The second thing I want to do is set up the BS2 to control a row of
numbers for a baseball scoreboard. You can get an idea of what I want
the baseball scoreboard to look like at
www.SportsAnnouncing.com/baseballscoreboard (you might have to put
a .html at the end, I can't remember).
I pretty much need to control each inning individually and then the
runs hits and errors individually as well. I'm planning on using a
computer to control the scoreboard at this point to make things easier
on me. Eventually I'm going to set up a separate controller to control
everything.

I'm ready to hit one thing at a time but if someone can answer both
questions, that would be great. I plan on printing every response I
get to make things easier.

Thanks in advance and thanks to those who helped in my decision on
which BS2 to get.

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

  • ArchiverArchiver Posts: 46,084
    edited 2002-11-19 14:16
    Jarrod-

    Here's a possible starting place for you. It uses DEBUG and SERIN
    statements to communicate with your PC's keyboard and display. It
    uses SERIN's timeout feature to count down seconds. It uses ASCII
    backspaces rather than carriage return/line feed so that the same
    line on the display is refreshed rather than scrolling down. The
    timing accuracy isn't spectacular, but you're not going to get great
    precision with your Stamp anyway. You can tweak the timeout value
    (1000) to improve the accuracy somewhat.

    If you press a key while the display is counting down, the countdown
    stops, the key you pressed is displayed, and you can insert whatever
    logic you need at that point.

    FWIW, I like the notion of using serial input with timeout, and
    serial output (DEBUG in this case) because you can easily adapt it
    to other I/O devices later.

    You can expand on these basic functions to set the timer value from
    the keyboard or whatever other features you may need.

    Regards,

    Steve


    '{$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
Sign In or Register to comment.