public class ActiveBuzzer extends GPIOComponent
You just need to apply 3V to 5V to this buzzer module. You can then simply connect the buzzer to a classical Gpio pin of the Raspberry Pi. If the pin is high: no sound. If the pin is low: sound.
Example Datasheet: Active Buzzer
Example of use: ActiveBuzzerExample
gpio
Constructor and Description |
---|
ActiveBuzzer(GPIOPin pin,
boolean inverse)
Constructor for an active buzzer, using a specific GPIOPin.
|
Modifier and Type | Method and Description |
---|---|
void |
beep(int millis)
Beep for a duration of millis milliseconds on and the millis milliseconds off.
|
void |
off()
Disable the buzzer.
|
void |
on()
Enable the buzzer.
|
getType
public ActiveBuzzer(GPIOPin pin, boolean inverse)
pin
- the Gpio pin used to access the active buzzer.inverse
- true if the buzzer beeps when the pin is low.
False if the buzzer beeps when the pin is high.