Simple PWM / beep generation library. Supports timed-duration beeps or infinite length tone generation.
Dependents: PseudoTheremin NSDL_HelloWorld_WiFi UbloxModemNanoServiceClient IOT-NSDL_HelloWorld ... more
Beep Class Reference
Generates a tone with a buzzer, based on a PwmOut The class use a timeout to switch off the sound - it is not blocking while making noise. More...
#include <Beep.h>
Public Member Functions | |
Beep (PinName pin) | |
Create a Beep object connected to the specified PwmOut pin. | |
void | beep (float frequency, float time=0) |
Beep with given frequency and duration. | |
void | nobeep () |
stop the beep instantaneously. |
Detailed Description
Generates a tone with a buzzer, based on a PwmOut The class use a timeout to switch off the sound - it is not blocking while making noise.
Example:
// Beep at 2kHz for 0.5 seconds #include "mbed.h" #include "Beep.h" Beep buzzer(p21); int main() { ... buzzer.beep(2000,0.5); ... }
Definition at line 24 of file Beep.h.
Constructor & Destructor Documentation
Beep | ( | PinName | pin ) |
Member Function Documentation
void beep | ( | float | freq, |
float | time = 0 |
||
) |
Generated on Thu Jul 14 2022 01:13:48 by
