Anybody have a cool tune for a piezo speaker on a bs2 board?
AndyG
Posts: 1
Anybody have a cool tune for a piezo speaker on a bs2 board?
Thanks
Andy
Thanks
Andy
Comments
I have attached some various codes for you to try.
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Andreae
Tech Support
dandreae@parallax.com
www.parallax.com
RTTTL_File DATA "simpsons:d=4,o=5,b=160:c6,e6,f#6,8a6,g6,e6,c6,8a,8f#,8f#,8f#,2g,8p,8p,8f#,8f#,8f#,8g,a#,8c6,8c6,8c6,c6"
I can get the program you posted "piezo pal.bs2" to run, but I have some questions about its code. The last code part is as follows:
SHOW4: DEBUG "Heart and Soul",CR
LOOP 'Get the next note to be played
Song4
LOOKUP indx,[noparse][[/noparse] C5, R, C5, R, C5, R, C5,BE4, A4,BE4, C5, D5,R, C5, E5, R, E5, R, E5,0],note
LOOKUP indx,[noparse][[/noparse]450,50,400,50,750,90,200,300,200,300,200,300,5,200,450,30,450,50,800],dura
IF note = 0 THEN DELAY 'it.
IF note = R THEN REST
FREQOUT 4,dura,note
NXT
indx = indx + 1
GOTO LOOP
REST
PAUSE dura
GOTO NXT
DELAY
note = 0
dura = 0
indx = 0
PAUSE 200
STOP
There is not a colon ([noparse]:)[/noparse] after the "labels" nxt, rest & delay. I thought you had to have a colon after labels? This works ptogram runs, but is it just not "good" coding? Your comments about how this code is written would help me in my own coding.
Joe Fishback
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA