![]() |
SparkFun Qwiic Buzzer
v1.1.0-16-gb717328
Library for the SparkFun Qwiic Buzzer
|
Arduino Library for the SparkFun Qwiic Buzzer breakout board
The SparkFun_Qwiic_Buzzer_Arduino_Library (BOB-24474) adds simple beeps and buzzes to your projects via I2C. Make some noises to alert you when something interesting (or urgent) happens. Simply connect a Qwiic cable and load up some pre-written code to an Arduino to start making noises!
The board includes an ATtiny84 with custom firmware to control the magnetic buzzer over I2C. Utilizing our handy Qwiic system, no soldering is required to connect it to the rest of your system. However, we still broke out 0.1 in -spaced PTH pads if you prefer to use a breadboard to access the board's I2C, power, trigger, and reset pins on the board's edge. A 2.2k ohm pull-up resistor is included on the data and clock lines.
Looking for the board that matches this library - pick up a SparkFun Qwiic Buzzer at SparkFun.
This library provides an interface that enables the following functionality when a SparkFun Qwiic Buzzer breakout board:
The following outlines the general use of the library in an Arduino Sketch.
At the start of your sketch, the library header file is included using the following statement:
Before the arduino setup() function, create a Buzzer object in your file with the following declaration:
In the Arduino setup() function, initialize the buzzer by calling the begin method. This method is called after the Arduino Wire (I2C) library is initialized.
The begin method returns true if the buzzer is connected and available, and false if it is not. If a value of false is returned in the above example, the sketch execution is halted.
Turn the buzzer on and off as shown in the following loop example:
The buzzer frequency is controlled using the configureBuzzer() method.
The buzz duration is set by adding a timing value after the frequency to the configureBuzzer() method.
The buzz volume is an additional optional parameter to the configureBuzzer() method.
The buzzer has a collection of sound effects included in this library. These are started by using the playSoundEffect() method, providing the number of the sound effect to play.
Playing sound effect 1:
The following examples are provided with the library
The full API and use documentation for this library is provided here. For a quick reference, the main methods available in the library are listed here.
Curious about the hardware this board works with - visit the SparkFun Qwiic Buzzer hardware repository.
The Hookup Guide for the SparkFun Qwiic Buzzer is available here.
This product is open source!
This product is licensed using the MIT Open Source License.