I use a piezo 'buzzer' (with built in oscillator, and a similar centre frequency to Erco's) in conjunction with the sound command for confirming button presses in menus and the like. I have an LED and resistor in parallel with the buzzer which lights as the sound is played, giving both visual and audible feedback. The buzzer and LED/resistor are connected directly from pin c.4 to ground, no transistors are fitted to amplify the signal.
Symbol definitions:
Code:
Symbol Buzz=c.4
Symbol SPitchHi=104
Symbol SPitchLo=100
Symbol SPitchChirp=110
Symbol SLenL=50
Symbol SLen=35
Symbol SLenS=10
Symbol STick=2
Symbol ShtDelay=250
My command for a 'Tick' to confirm button presses is:
Code:
Sound Buzz,(SPitchChirp,STick)
It is surprising how much difference there is between sounds of relatively small changes in pitch (110 to 104 to 100) and varying the duration (50 to 35 to 10 to 2).
Further differentiation is made by combining sound sequences.
For an option turned on: (Beeps start low and end with a longer high)
Code:
Sound Buzz,(SPitchLo,SLenS)
Pause ShtDelay
Sound Buzz,(SPitchHi,SLenS)
Pause ShtDelay
Sound Buzz,(SPitchChirp,SLenL)
For an option turned off: (Beeps start high and end with a longer low)
Code:
Sound Buzz,(SPitchChirp,SLenS)
Pause ShtDelay
Sound Buzz,(SPitchHi,SLenS)
Pause ShtDelay
Sound Buzz,(SPitchLo,SLenL)
My intention was (and I think I succeeded) to provide a simple menu that had only audio (with visual confirmation from the associated LED) feedback, allowing selection of five or six options with on or off of the options indicated on change, as well as incrementing those that had numeric options, with no LCD display fitted and with only two buttons.