In this section, we will learn how to use a Piezo Buzzer and make sounds using some in-built C functions. A Piezo Buzzer is like a small speaker capable of emitting sounds at various frequencies. A typical Piezo Buzzer is shown in the following figure:
Figure 3: A Piezo Buzzer
A Piezo Buzzer has two legs, one longer positive leg and one shorter negative leg. The negative leg is connected to the ground while the longer positive leg is usually connected to an Arduino pin via a 100 Ohms resistor.
Sometimes, you may find a small sticker pasted to the top of a brand new Piezo Buzzer that says, "Remove after washing". Do not get confused by this, it is just a leftover sticker from the Buzzer manufacturing process, which was not removed. Just ignore and remove the sticker. Do not wash the Buzzer!
For building the Piezo Buzzer project, we will use the...