Attaching a Piezo Buzzer

Just like using the LEDs, we are going to get an output from the buzzer when we send an electrical current. With this small buzzer, there is no volume control. The sound is based on the quantity of electricity that is received.

If you turn the voltage on and off fast enough, you get different beeps, squeals, chirps and buzzes.

If you flip the buzzer over and look at the bottom, you will see that one pin has a (+) next to it. That pin gets connected to a signal from the P0 pin. The other pin should be connected to ground.

So how does this little buzzer work? I don't see an on off switch?

send electricity to buzzer to make sound
stop electricty to buzzer to stop sound

Try and make a simple sound by writing to the PIN

Start
    digital write pin 0 to 1
    play tone Middle C for 2 beats
    digital write pin 0 to 0

Assignment:

Last updated