Beep using PWM and speaker

Dependents:   20180621_FT813

Fork of beep by Pallavi Prasad

Embed: (wiki syntax)

« Back to documentation index

mbed Namespace Reference

mbed Namespace Reference

class to make sound 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...


Detailed Description

class to make sound 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 with 1Khz for 0.5 seconds
 #include "mbed.h"
 #include "beep.h"
 
 Beep buzzer(p21);
 
 int main() {
        ...
   buzzer.beep(1000,0.5);    
       ...
 }