Parallax Boe-Bot Student Manual page 123

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

Advertisement

Programming the Start/Reset Indicator
The next example program tests the piezospeaker. It uses the
precisely timed high/low signals to a speaker. Here is the
FREQOUT Pin, Duration, Freq1 {,Freq2}
Here's an example of a
FREQOUT
FREQOUT 4, 2000, 3000
The
argument is 4, meaning that the high/low signals will be sent to I/O pin P4. The
Pin
argument, which is how long the high/low signals will last, is 2000, which is
Duration
2000 ms or 2 seconds. The
this example, the high/low signals will make a 3000 hertz, or 3 kHz, tone.
Frequency can be measured in hertz (Hz). The hertz is a frequency measurement of how
many times per second something happens. One hertz is simply one time-per-second, and
it's abbreviated 1 Hz. One kilohertz is one-thousand-times-per-second, and it's abbreviated
1 kHz.
digitally synthesizes tones. The
FREQOUT
of varying durations that make a piezospeaker's vibration more closely resemble natural
vibrations of music strings.
Example Program: StartResetIndicator.bs2
This example program makes a beep at the beginning of the program, then it goes on to
run a program that sends
continue indefinitely because they are nested between
BASIC Stamp is interrupted while it is in the middle of its
start at the beginning again. When it starts over, it will beep again. You can simulate a
brownout condition by either pressing and releasing the Reset button on your board or
disconnecting and reconnecting your board's battery supply.
Reconnect power to your board.
Enter, save, and run StartResetIndicator.bs2.
Verify that the piezospeaker made a clearly audible tone for two seconds before
the "Waiting for reset..." messages started to display in the Debug Terminal.
Chapter 3: Assemble and Test Your Boe-Bot · Page 109
command that's used in the next example program.
argument is the frequency of the high/low signals. In
Freq1
FREQOUT
messages every half second. These messages will
DEBUG
command to send
FREQOUT
command's syntax:
FREQOUT
command applies high/low pulses
and
. If the power to the
DO
LOOP
, the program will
DO...LOOP

Advertisement

Table of Contents
loading

Table of Contents