Simple Button plays a tone
overlook77
Posts: 10
I have the StampWorks Kit with the professional development board and a BS2.· I am trying to learn the PBASIC language but am having trouble.· I want Button 0 to make a sound whenever you press it.· However, my code only plays the tone by itself once and the button does nothing.· Can someone correct my code?
' {$STAMP BS2}
WkSpace VAR Byte
Main:
····· BUTTON 8, 1, 0, 0, WkSpace, 1, PlayTone
· PlayTone:
··· FREQOUT 7, 250, 3000
' {$STAMP BS2}
WkSpace VAR Byte
Main:
····· BUTTON 8, 1, 0, 0, WkSpace, 1, PlayTone
· PlayTone:
··· FREQOUT 7, 250, 3000
Comments
' {$STAMP BS2}
' {$PBASIC 2.5}
Btn PIN 8
btnWrk VAR Byte
Main:
BUTTON Btn, 0, 200, 20, btnWrk, 0, No_Press
FREQOUT 7, 150, 2000
No_Press:
GOTO Main