Playing Music on Your Boe Bot

14,966

4

Hi there! today i will show you how to program a parallax Boe bot to sing Yankee doodle! so lets look at some of the code I wrote up! try it out! you can hack the code a little by looking at what I've done and looking at the variables, c6 is normal and c7 is sharp ect.

' {$STAMP BS2}
' {$PBASIC 2.5}
' -----[ Title ]-----------------------------------------------------------------------

' What's a Microcontroller - YANKEE DOODLE


' -----[ Variables/Constants/Pins ]----------------------------------------------------


FreqDetectable    CON    3000

C6            CON    1047              ' Piano notes
D6            CON    1175
E6            CON    1319
F6            CON    1397
G6            CON    1568
A6            CON    1760
Be6           CON    1976

C7                CON    2093
D7                CON    2349
E7                CON    2637
F7                CON    2793
G7                CON    3136
A7                CON    3520
Be7                CON    3951
C8                CON    4186              ' end of piano notes


Piezospeaker      PIN    4                 ' Speaker



' -----[ Main Routine ]----------------------------------------------------------------


FREQOUT Piezospeaker, 500,C7
PAUSE 50
FREQOUT Piezospeaker, 500,C7
PAUSE 50
FREQOUT Piezospeaker, 500,D7
PAUSE 50
FREQOUT Piezospeaker, 500,E7
PAUSE 50
FREQOUT Piezospeaker, 500,C7
PAUSE 50
FREQOUT Piezospeaker, 500,E7
PAUSE 50
FREQOUT Piezospeaker, 1000,D7
PAUSE 50
FREQOUT Piezospeaker, 500,C7
PAUSE 50
FREQOUT Piezospeaker, 500,C7
PAUSE 50
FREQOUT Piezospeaker, 500,D7
PAUSE 50
FREQOUT Piezospeaker, 500,E7
PAUSE 50
FREQOUT Piezospeaker, 500,C7
PAUSE 50
FREQOUT Piezospeaker, 1000,BE6
PAUSE 50
FREQOUT Piezospeaker, 500,C7
PAUSE 50
FREQOUT Piezospeaker, 500,C7
PAUSE 50
FREQOUT Piezospeaker, 500,D7
PAUSE 50
FREQOUT Piezospeaker, 500,E7
PAUSE 50
FREQOUT Piezospeaker, 500,F7
PAUSE 50
FREQOUT Piezospeaker, 500,E7
PAUSE 50
FREQOUT Piezospeaker, 500,D7
PAUSE 50
FREQOUT Piezospeaker, 500,C7
PAUSE 50
FREQOUT Piezospeaker, 500,BE6
PAUSE 50
FREQOUT Piezospeaker, 500,G6
PAUSE 50
FREQOUT Piezospeaker, 500,A6
PAUSE 50
FREQOUT Piezospeaker, 500,BE6
PAUSE 50
FREQOUT Piezospeaker, 1000,C7
PAUSE 50
FREQOUT Piezospeaker, 1000,C7

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

A/V Contest

Participated in the
A/V Contest

Be the First to Share

    Recommendations

    • CNC Contest

      CNC Contest
    • Make it Move

      Make it Move
    • Teacher Contest

      Teacher Contest

    Discussions