ezBuzzer Library - Beep Example
This example uses a piezo buzzer:
- Generates a 100ms beep on background when a button is pressed
- Without using delay() function, this is a non-blocking example
|1||×||Arduino UNO or Genuino UNO|
|1||×||USB 2.0 cable type A/B|
About ezBuzzer Library
- Refer to Arduino - ezBuzzer Library Reference
Image is developed using Fritzing. Click to enlarge image
- Install ezBuzzer library. See How To
- Connect Arduino to PC via USB cable
- Open Arduino IDE, select the right board and port
- On Arduino IDE, Go to File Examples ezBuzzer Beep example
- Click Upload button on Arduino IDE to upload code to Arduino
- Press and release the button some time
- You will hear a beep each time you press button.
Read the line-by-line explanation in comment lines of source code!
※ NOTE THAT:
The above example code demonstrates how to use the ezBuzzer library to make a beep on Piezo Buzzer each time button is pressed. In practice, You may need to debounce for the button. Debouncing for the button is not easy for beginners. Fortunately, thanks to the ezButton library, We can do it easily.