Parallax Boe-Bot Student Manual page 124

Hide thumbs Also See for Boe-Bot:
Table of Contents

Advertisement

Page 110 · Robotics with the Boe-Bot
If you did not hear a tone, check your wiring and code for errors. Repeat until
you get an audible tone from your speaker.
If you did hear an audible tone, try simulating the brownout condition by
pressing and releasing the Reset button on your board.
piezospeaker makes a clearly audible tone after each reset.
Also try disconnecting and reconnecting your battery supply, and verify that this
results in the reset warning tone as well.
' Robotics with the Boe-Bot - StartResetIndicator.bs2
' Test the piezospeaker circuit.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG CLS, "Beep!!!"
FREQOUT 4, 2000, 3000
DO
DEBUG CR, "Waiting for reset..."
PAUSE 500
LOOP
How StartResetIndicator.bs2 Works
StartResetIndicator.bs2 starts by displaying the message "Beep!!!" Then, immediately
after printing the message, the
speaker for 2 s. Because the instructions are executed so rapidly by the BASIC Stamp, it
should seem as though the message is displayed at the same instant the piezospeaker
starts to play the tone.
When the tone is done, the program enters a
reset..." message over and over again. Each time the reset button on the Board of
Education is pressed or the power is disconnected and reconnected, the program starts
over again, with the "Beep!!!" message and the 3 kHz tone.
Your Turn - Adding StartResetIndicator.bs2 to a Different Program
The lines of code in the battery indicator program will be used at the beginning of every
example program from here onward. You could consider it part of the "initialization
routine" or "boot routine" for every Boe-Bot program.
' Stamp directive.
' PBASIC directive.
' Display while speaker beeps.
' Signal program start/reset.
' DO...LOOP
' Display message
' every 0.5 seconds
' until hardware reset.
command plays a 3 kHz tone on the piezoelectric
FREQOUT
, displaying the same "Waiting for
DO...LOOP
Verify that the

Advertisement

Table of Contents
loading

Table of Contents