An Arduino library for the PiicoDev Buzzer Module, driven over I2C.
It lets you play tones at a chosen frequency and duration, set the volume, and detect the module on the bus.
In the Arduino IDE: Sketch → Include Library → Manage Libraries…, then search for PiicoDev_Buzzer and click Install.
- Download this repository as a ZIP (Code → Download ZIP).
- In the Arduino IDE: Sketch → Include Library → Add .ZIP Library… and select the downloaded file.
- Or clone/copy this folder into your
Arduino/libraries/directory.
Connect the PiicoDev Buzzer to your board's I2C pins (SDA / SCL). The default
I2C address is 0x5C (all ID switches off).
#include <PiicoDev_Buzzer.h>
PiicoDev_Buzzer buzzer; // default address 0x5C on the Wire bus
void setup() {
Serial.begin(115200);
if (buzzer.begin()) {
Serial.println("PiicoDev Buzzer found");
} else {
Serial.println("Buzzer NOT found - check wiring/address switches");
}
}
void loop() {
buzzer.tone(440, 300); // 440 Hz for 300 ms
delay(500);
}See examples/ToneSequence for a full sketch.
| Method | Description |
|---|---|
PiicoDev_Buzzer(uint8_t address = 0x5C, TwoWire &wire = Wire) |
Construct with an optional I2C address and bus. |
bool begin(uint8_t volume = BUZZER_VOLUME_HIGH) |
Start I2C, set the volume, and return true if the module responds. |
void tone(uint16_t frequency, uint16_t durationMs = 0) |
Play frequency Hz for durationMs ms. 0 duration plays continuously. |
void noTone() |
Stop the current tone. |
void volume(uint8_t level) |
Set volume: BUZZER_VOLUME_OFF / LOW / HIGH (0 / 1 / 2). |
bool isConnected() |
Return true if the module acknowledges on the bus. |
"PiicoDev" and the PiicoDev logo are trademarks of Core Electronics Pty Ltd.