Arduino TKJHAT
Arduino library for Pico HAT extension board
Loading...
Searching...
No Matches
Buzzer.ino
/*
Buzzer Example
This example shows how to use the Buzzer class to play a tone at a specific frequency and duration.
Circuit:
- Buzzer integrated in Pico HAT
created 2026
*/
#include "TKJHAT.h"
// Create an instance of the TKJHAT class
TKJHAT hat;
// Initialize the buzzer
void setup() {
hat.buzzer.begin();
}
// In this loop, we will play a tone at 1000 Hz for 1 second, then wait for 1 second before repeating
// First value is the frequency in Hz, and the second value is the duration in milliseconds
void loop() {
hat.buzzer.playTone(1000, 1000);
delay(1000);
}
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