One of my 13 year old students, Jessa Karlberg, programmed her BoeBot, Roger, to sing Ode to Joy. I've attached the program for those who are interested.
hey that is preatty cool i have been working on getting master of pupets by metalica on mine for a while but getting the note lenthgs correct is tricky!
I just made this code to make your bot sing. Type in numbers 1-7 for some notes. The only scematic you need is a peizospeaker attached to P4 and wired to end at the second spot from the right on the Vss row.
' {$STAMP BS2}
' {$PBASIC 2.5}
counter VAR Word
frequency VAR Word
DO
DEBUG "Enter note: "
DEBUGIN DEC frequency
SELECT frequency
CASE 1
FOR counter = 1 TO 1
FREQOUT 4, 1000, 2000
NEXT
CASE 2
FOR counter = 1 TO 1
FREQOUT 4, 1000, 2500
NEXT
CASE 3
FOR counter = 1 TO 1
FREQOUT 4, 1000, 3000
NEXT
CASE 4
FOR counter = 1 TO 1
FREQOUT 4, 1000, 3500
NEXT
CASE 5
FOR counter = 1 TO 1
FREQOUT 4, 1000, 4000
NEXT
CASE 6
FOR counter = 1 TO 1
FREQOUT 4, 1000, 4500
NEXT
CASE 7
FOR counter = 1 TO 1
FREQOUT 4, 1000, 5000
NEXT
ENDSELECT
LOOP
' {$STAMP BS2}
' {$PBASIC 2.5}
counter VAR Word
frequency VAR Word
DO
DEBUG "Enter note: "
DEBUGIN DEC frequency
SELECT frequency
'-----a-----
CASE 1
FOR counter = 1 TO 1
FREQOUT 4, 500, 930
NEXT
'-----b flat-------
CASE 2
FOR counter = 1 TO 1
FREQOUT 4, 500, 970
NEXT
'-----b------
CASE 3
FOR counter = 1 TO 1
FREQOUT 4, 500, 1030
NEXT
'-----c-----
CASE 4
FOR counter = 1 TO 1
FREQOUT 4, 500, 1100
NEXT
'-----c sharp-----
CASE 5
FOR counter = 1 TO 1
FREQOUT 4, 500, 1180
NEXT
'-----d-----
CASE 6
FOR counter = 1 TO 1
FREQOUT 4, 500, 1240
NEXT
'-----e-----
CASE 7
FOR counter = 1 TO 1
FREQOUT 4, 500, 1400
NEXT
'-----f-----
CASE 8
FOR counter = 1 TO 1
FREQOUT 4, 500, 1500
NEXT
'-----f sharp-----
CASE 9
FOR counter = 1 TO 1
FREQOUT 4, 500, 1590
NEXT
'-----g------
CASE 10
FOR counter = 1 TO 1
FREQOUT 4, 500, 1630
NEXT
The notes listed below are not correct...
The actual frequencies are:
440-A
446-A# or Bb
493-B
523-C
554-C# or Db
587-D
622-D# or Eb
659-E
698-F
740-F# or Gb
784-G
830-G# or Ab
880-A
To go up or down an octave from the above notes you double or half the frequency. As you can see from the A's I listed (440 hz and 880 hz), this formula works.
Comments
The actual frequencies are:
440-A
446-A# or Bb
493-B
523-C
554-C# or Db
587-D
622-D# or Eb
659-E
698-F
740-F# or Gb
784-G
830-G# or Ab
880-A
To go up or down an octave from the above notes you double or half the frequency. As you can see from the A's I listed (440 hz and 880 hz), this formula works.
http://forums.parallax.com/showthread.php?p=687747
It's fairly easy to implement and small for a BOEBOT too.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Still some PropSTICK Kit bare PCBs left!