Skip to content

Commit e8f249b

Browse files
committed
example 1 working
1 parent 919b1b6 commit e8f249b

File tree

4 files changed

+94
-90
lines changed

4 files changed

+94
-90
lines changed

examples/Example1_PrintButtonStatus/Example1_PrintButtonStatus.ino

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/******************************************************************************
2+
Example_01_Buzz
3+
4+
This example shows how to turn the buzzer on and off.
5+
Much like the classic "blink LED sketch" this will buzz
6+
the buzzer once every second.
7+
8+
By Pete Lewis @ SparkFun Electronics
9+
December 2023
10+
11+
Based on code orginally written by Fischer Moseley @ SparkFun Electronics
12+
Original Creation Date: June 28, 2019
13+
14+
This code is Lemonadeware; if you see me (or any other SparkFun employee) at the
15+
local, and you've found our code helpful, please buy us a round!
16+
17+
Hardware Connections:
18+
Connect QWIIC cable from Arduino to Qwiic Buzzer
19+
20+
Distributed as-is; no warranty is given.
21+
******************************************************************************/
22+
23+
#include <SparkFun_Qwiic_Buzzer_Arduino_Library.h>
24+
QwiicBuzzer buzzer;
25+
26+
void setup() {
27+
Serial.begin(115200);
28+
Serial.println("Qwiic Buzzer Example_01_Buzz");
29+
Wire.begin(); //Join I2C bus
30+
31+
//check if button will acknowledge over I2C
32+
if (buzzer.begin() == false) {
33+
Serial.println("Device did not acknowledge! Freezing.");
34+
while (1);
35+
}
36+
Serial.println("Buzzer acknowledged.");
37+
}
38+
39+
void loop() {
40+
buzzer.on();
41+
42+
delay(1000);
43+
44+
buzzer.off();
45+
46+
delay(1000);
47+
}

0 commit comments

Comments
 (0)