beautypg.com

Project b9 jukebox with terminal – Elenco Snap Circuits XP ® User Manual

Page 43

background image

As it is, this program will not work
properly.

To fix it,

modify the program to

subtract 49 from variable b2 in line 7

,

instead of subtracting 1. The serin command
in line 6 gives a coded value for variable b2
(called its ASCII code), because you could
have typed a letter instead of a number.

Alternatively, you could place case numbers
0-3 in lines 13, 15, 17, and 19 in quotation
marks (“0”, “1”, “2”, and “3”).

Project B9

Jukebox with Terminal

-42-

Build the circuit as shown. Turn on the slide
switch (S1). Load program Jukebox with
Terminal and

modify it as described below

.

Load the modified program into the
microcontroller (U21) using the programming
instructions in project B1.

After program is downloaded, move the
orange jumper wire from the S-In snap to the
1 snap, as shown. Press the F8 key or select
Terminal under the PICAXE menu to open a
terminal window for communication with the
microcontroller, set the baud rate to 2400,
and select Refresh. Turn the slide switch (S1)
off and on to reset the microcontroller. Follow
the instructions in the terminal Input Buffer
window to use your “jukebox”.

Song numbers:
1 = Happy Birthday
2 = Jingle Bells
3 = Silent Night
4 = Rudolph

Optional:

(for two-way

communication

with terminal)

(for download)

This program uses the

serin

and

serout

commands to

send information between the
computer screen and the
microcontroller. Details on
how these commands work
can be found under the Help
menu at Snap Circuits

®

XP

TM

.