Shop OBEX P1 Docs P2 Docs Learn Events
PENGUIN ROBOT Brain Timer - the Code — Parallax Forums

PENGUIN ROBOT Brain Timer - the Code

HumanoidoHumanoido Posts: 5,770
edited 2007-10-31 07:16 in Robotics
Penguin robot has a brain. The mission: to put stuff
into the brain! Knowing time and counting are
important functions.

Welcome to the Penguin Brain Timer. This program is part of
the counting and timing code series. It uses a truth table
to count up to 60 seconds using the 1 digit display and
1 digit numbers.

It's a clock too, with display, timing, and credible ticking
sound. Penguin Brain Timer, counting minutes today,
the world tomorrow!

humanoido

Title: Penguin Brain Timer
Code Name: penguin_brain_timer.bpx
Purpose: One minute Counter & Timer with Display & Ticking Sound


' PENGUINS' ONE MINUTE BRAIN TIMER uses some kind of Vulcan technology
' to time events, as a seconds timer starting at 0 and incrementing
' upwards to one full minute. It uses the one digit display and
' shows only one digit numbers, one at a time, to achieve sixty
' seconds and uses a simple Truth Table to count like this:
'
'                 One Minute Truth Table
'                 ----------------------
'                 0 1 2 3 4 5 6 7 8 9  1
'                 1 2 3 4 5 6 7 8 9    2
'                 1 2 3 4 5 6 7 8 9    3
'                 1 2 3 4 5 6 7 8 9    4
'                 1 2 3 4 5 6 7 8 9    5
'                 1 2 3 4 5 6 7 8 9    6
'
' It's really easy to see the counting pattern in the truth
' table. For the exact details, refer to the One Minute
' Equivalency Table.
'
'                 One Minute Equivalency Table
'                 ----------------------------
'                 0   1   2   3   4   5   6   7   8   9   10
'                 11  12  13  14  15  16  17  18  19      20
'                 21  22  23  24  25  26  27  28  29      30
'                 31  32  33  34  35  36  37  38  39      40
'                 41  42  43  44  45  46  47  48  49      50
'                 51  52  53  54  55  56  57  58  59      60
'
' The sound is forgiven at the tens increment to note the position
' in the time.
'
' This program uses the statements as part of the timing. For short
' durations such as one minute, the microcontrollers internal pulse
' is highly accurate. For this, pause statements when added with
' program statements yield an accurate timing base.
'
' There are two loops to do the counting. The first loop counts
' the tens digits 1 through 6. The inner loop counts the ones
' from 1 through 9.

' Using the truth table allows a one digit display to count one
' minute using only digits 0 through 9.
Sign In or Register to comment.