Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Servo ros_lib_kinetic
Buzzer/Buzzer.cpp
- Committer:
 - hongyunAHN
 - Date:
 - 2020-01-10
 - Revision:
 - 11:12e73437dc9f
 - Parent:
 - 6:2cc2aac35868
 
File content as of revision 11:12e73437dc9f:
#include "Buzzer.h"
cBuzzer::cBuzzer(DigitalOut Buzz): _Buzz(Buzz)
{
   _Buzz = 0; 
}
/*--------------------------------------------------------------------------------
Function name: short_buzz()
Input Parameters: N/A
Output Parameters: N/A
Description: Turns the buzzer on for a short period of time
----------------------------------------------------------------------------------*/
void cBuzzer::Beep()
{
    _Buzz =1; 
    wait (0.5);
    _Buzz =0;
    
}
/*--------------------------------------------------------------------------------
Function name: buzzer_on()
Input Parameters: N/A
Output Parameters: N/A
Description: Turns the buzzer on indefinitely
----------------------------------------------------------------------------------*/
void cBuzzer::buzzer_on()
{
    _Buzz = 1;    //Enable Buzzer
}
/*--------------------------------------------------------------------------------
Function name: buzz_off()
Input Parameters: N/A
Output Parameters: N/A
Description: Turns buzzer off indefinitely
----------------------------------------------------------------------------------*/
void cBuzzer::buzz_off()
{
    _Buzz = 0;    //Disable Buzzer
}