Arduino TKJHAT
Arduino library for Pico HAT extension board
Loading...
Searching...
No Matches
Buzzer.ino
1/*
2 Buzzer Example
3
4 This example shows how to use the Buzzer class to play a tone at a specific frequency and duration.
5
6 Circuit:
7 - Buzzer integrated in Pico HAT
8
9 created 2026
10*/
11
12#include "TKJHAT.h"
13
14// Create an instance of the TKJHAT class
15TKJHAT hat;
16
17// Initialize the buzzer
18void setup() {
19 hat.buzzer.begin();
20}
21
22
23// In this loop, we will play a tone at 1000 Hz for 1 second, then wait for 1 second before repeating
24// First value is the frequency in Hz, and the second value is the duration in milliseconds
25void loop() {
26 hat.buzzer.playTone(1000, 1000);
27 delay(1000);
28}
void begin()
Initialize the buzzer pin Configures the buzzer pin as a digital output.
Main interface for accessing TKJHAT board features.
Definition TKJHAT.h:35
Buzzer buzzer
Buzzer output.
Definition TKJHAT.h:47