Piezo Notes and Programming

Hey Forum.

I'm currently working on a project that requires the use of a Piezo to play a victory tune once a certain action is accomplished. I'm a novice, and I was wondering how exactly a piezo buzzer works/how to make it play certain notes? Any help would be appreciated.

See the [u]Play Melody Example[/u].

Make sure you have a Piezo transducer (AKA "speaker" or "tweeter"). These take an electrical signal and convert it to sound, so the pitch/frequency of the sound matches the frequency of the electrical signal.

Transducers are the most common type, but there are Piezo "buzzers" or "beepers" that have their own built-in sound-generating circuit. They run off DC voltage and you can't change the frequency of a buzzer.

Also note that the Arduino doesn't have a digital-to-analog converter so you can only get full-voltage square & rectangle waves (no "pure tone" sine waves).

Use the tone library
https://www.arduino.cc/en/Reference/Tone

Alright, I’ll try that out. Thanks for your help.