CrossGuard
|
A class to control a buzzer connected to a GPIO pin. More...
#include <Buzzer.h>
Public Member Functions | |
Buzzer (int pin) | |
Constructs a Buzzer object associated with a specific GPIO pin. | |
void | on () |
Turns the buzzer on by setting the GPIO pin high. | |
void | off () |
Turns the buzzer off by setting the GPIO pin low. | |
A class to control a buzzer connected to a GPIO pin.
This class provides simple interfaces to turn a buzzer on and off using the specified GPIO pin on a Raspberry Pi or compatible devices. It relies on the pigpio library (or its stub for non-Raspberry Pi environments) for GPIO pin control.
|
explicit |
Constructs a Buzzer object associated with a specific GPIO pin.
Constructor for the Buzzer class.
Initializes the GPIO library if necessary and sets the specified pin as an output for the buzzer control.
pin | The GPIO pin number where the buzzer is connected. |
Initializes the GPIO pin used by the buzzer and sets it to output mode.
pin | GPIO pin number connected to the buzzer. |
void Buzzer::off | ( | ) |
Turns the buzzer off by setting the GPIO pin low.
Turn the buzzer off.
Sets the GPIO pin to low, deactivating the buzzer.
void Buzzer::on | ( | ) |
Turns the buzzer on by setting the GPIO pin high.
Turn the buzzer on.
Sets the GPIO pin to high, activating the buzzer.