Project 4: other sounds – Elenco Snap Circuits SnapMicro ® I Standard User Manual

Page 32

Advertising
background image

31

Project 4: Other Sounds

The ‘sound’ command

Syntax:

SOUND pin,(note,duration,note,duration...)

- Pin is a variable/constant (0-4), which specifies
the i/o pin to use.
- Note(s) are variables/constants (0-255) which
specify type and frequency.
Note 0 is silent for the duration.
Notes 1-127 are ascending tones.
Notes 128-255 are ascending white noises.
- Duration(s) are variables/constants (0-255)
which specify duration of the note (multiples of
approx 10ms).
Function:
Play sound ‘beep’ (1-127) or noises (128-255).
Information:
Frequency and duration must be used in ‘pairs’
within the command.

Draw the flow chart shown above. Use the ‘other’ button and
the ‘…’ box to create the ‘inc b0’ box. The ‘Sound’ command is
under the ‘out’ menu. Be sure to edit the sound command to
“sound 2,(b0,1)”. Use the IF button and the var box to
create the “b0>127” box.

Save the flowchart for your reference and convert it to a basic
program. The converted program should be similar to the one
shown on the left. This program is 20 bytes long and looks a

little confusing. Try editing the program to appear as shown on the next page.

N

Y

Advertising