beautypg.com

Project b4 play a tune – Elenco XP&trade User Manual

Page 37

background image

Project B4

Play a Tune

Optional:

You can adjust the tempo of the song by changing the
second number in the Tune command of this program to any
whole number from 1 (fast) to 15 (slow), then re-download.
Do not change anything else in the program.

-36-

The Tune command produces musical
notes (in the form of an electrical
voltage) on output 2.

It is possible to create your own music
using the tune command, but this is not
recommended because the coding
method is complicated and not easy to
use. Programming Editor (a more
advanced version of PICAXE software)
has a Tune Wizard that makes creating
or importing music easy. See page 59 for
more information about Programming
Editor.

Many more tunes are available for your PICAXE

®

08M microcontroller:

http://www.rev-ed.co.uk/software/tunes1_1.zip (450 tunes)

http://www.rev-ed.co.uk/software/tunes2_1.zip (350 tunes)

http://www.rev-ed.co.uk/software/christmas_1.zip (72 Christmas Songs)

http://www.rev-ed.co.uk/software/tvthemes_1.zip (48 TV & Movie tunes)

http://www.rev-ed.co.uk/software/anthems_1.zip (15 national anthems)

These files must be downloaded and unzipped into a new folder on your computer.
Then they can be downloaded into your microcontroller from that folder.

Build the circuit as shown. Turn on the slide switch (S1). Load
any of the programs whose name starts with “Song-” (such as
Song-PopGoesWeasel) into the microcontroller (U21) using the
programming instructions in project B1. Program Piano can
also be used.

The microcontroller will play a tune and may flash some lights.
Use the lever on the adjustable resistor (RV) to adjust the volume.