A class to control a buzzer. More...
#include <Buzzer.h>
Public Member Functions | |
| void | begin () |
| Initialize the buzzer pin Configures the buzzer pin as a digital output. | |
| Buzzer (uint8_t pin) | |
| Construct a new Buzzer object. | |
| void | playTone (uint32_t frequency, uint32_t duration) |
| Play a tone on the buzzer. | |
| void | turnOff () |
| Turn off the buzzer. | |
A class to control a buzzer.
This module provides simple control for the buzzer (BUZZER_PIN — GPIO 17).
Buzzer (BUZZER_PIN — GPIO 17)
{@
| Buzzer::Buzzer | ( | uint8_t | pin | ) |
Construct a new Buzzer object.
| pin | GPIO pin connected to the buzzer |
| void Buzzer::playTone | ( | uint32_t | frequency, |
| uint32_t | duration ) |
Play a tone on the buzzer.
Generates a square wave at the requested frequency for the specified duration by toggling the buzzer pin.
Play a tone on the buzzer
| frequency | Frequency of the tone in Hz |
| duration | Duration of the tone in milliseconds |
| void Buzzer::turnOff | ( | ) |
Turn off the buzzer.
Drives the buzzer pin low.