Skip to content

This library is designed for buzzer to beep or play melody on background without blocking other code

Notifications You must be signed in to change notification settings

ArduinoGetStarted/buzzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Buzzer Library for Arduino - ezBuzzer

This library is designed for a buzzer to beep or play melody without blocking other code.

ezBuzzer stands for easy buzzer, which means that the library is easy to use.

Features

  • Supports both active and passive buzzers
  • Supports active HIGH and active LOW buzzers
  • Supports beep with customizable frequency
  • Supports melody playback
  • Supports manual ON/OFF control
  • All functions are non-blocking (no delay() function)
  • Cross-platform compatible (all Arduino architectures)

Available Examples

Available Functions

  • ezBuzzer(pin, buzzerType, activeLevel) - Constructor with buzzer type and active level
  • stop() - Stop buzzer and cancel any ongoing beep/melody
  • turnON() - Turn buzzer ON continuously
  • turnOFF() - Turn buzzer OFF (same as stop)
  • beep(time) - Beep for specified duration
  • beep(time, delay) - Beep with delay before starting
  • beep(time, delay, frequency) - Beep with custom frequency (passive buzzer)
  • playMelody(melody, durations, length) - Play a melody
  • setBuzzerType(type) - Set BUZZER_TYPE_ACTIVE or BUZZER_TYPE_PASSIVE
  • setBeepFrequency(frequency) - Set default beep frequency for passive buzzer
  • getState() - Get current buzzer state
  • loop() - Must be called in loop() for non-blocking operation

Buzzer Types

  • BUZZER_TYPE_ACTIVE - Active buzzer (has internal oscillator, uses digitalWrite)
  • BUZZER_TYPE_PASSIVE - Passive buzzer (requires PWM signal, uses tone())

Active Levels

  • HIGH - Buzzer sounds when pin is HIGH (default, most common)
  • LOW - Buzzer sounds when pin is LOW (some shields like Multi-Function Shield)

Tested Hardware

Buzzer Modules:

MCU Boards:

Board Tested Notes
Arduino Uno R3 Fully supported
Arduino Uno R4 WiFi Fully supported
Arduino Uno R4 Minima Fully supported
Arduino Mega Fully supported
Arduino Giga Fully supported
DIYables STEM V3 Board Fully supported
DIYables STEM V4 IoT Board Fully supported
DIYables Compact V3.0 ATMEGA328P Fully supported
DIYables ESP32 Fully supported
DIYables ESP8266 Fully supported

How To Install the Library

References

About

This library is designed for buzzer to beep or play melody on background without blocking other code

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages