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@11:12e73437dc9f, 2020-01-10 (annotated)
- Committer:
 - hongyunAHN
 - Date:
 - Fri Jan 10 15:05:11 2020 +0000
 - Revision:
 - 11:12e73437dc9f
 - Parent:
 - 6:2cc2aac35868
 
ii
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| Stumi | 6:2cc2aac35868 | 1 | #include "Buzzer.h" | 
| Stumi | 6:2cc2aac35868 | 2 | |
| Stumi | 6:2cc2aac35868 | 3 | cBuzzer::cBuzzer(DigitalOut Buzz): _Buzz(Buzz) | 
| Stumi | 6:2cc2aac35868 | 4 | { | 
| Stumi | 6:2cc2aac35868 | 5 | _Buzz = 0; | 
| Stumi | 6:2cc2aac35868 | 6 | |
| Stumi | 6:2cc2aac35868 | 7 | } | 
| Stumi | 6:2cc2aac35868 | 8 | |
| Stumi | 6:2cc2aac35868 | 9 | /*-------------------------------------------------------------------------------- | 
| Stumi | 6:2cc2aac35868 | 10 | Function name: short_buzz() | 
| Stumi | 6:2cc2aac35868 | 11 | Input Parameters: N/A | 
| Stumi | 6:2cc2aac35868 | 12 | Output Parameters: N/A | 
| Stumi | 6:2cc2aac35868 | 13 | Description: Turns the buzzer on for a short period of time | 
| Stumi | 6:2cc2aac35868 | 14 | ----------------------------------------------------------------------------------*/ | 
| Stumi | 6:2cc2aac35868 | 15 | void cBuzzer::Beep() | 
| Stumi | 6:2cc2aac35868 | 16 | { | 
| Stumi | 6:2cc2aac35868 | 17 | _Buzz =1; | 
| Stumi | 6:2cc2aac35868 | 18 | wait (0.5); | 
| Stumi | 6:2cc2aac35868 | 19 | _Buzz =0; | 
| Stumi | 6:2cc2aac35868 | 20 | |
| Stumi | 6:2cc2aac35868 | 21 | } | 
| Stumi | 6:2cc2aac35868 | 22 | /*-------------------------------------------------------------------------------- | 
| Stumi | 6:2cc2aac35868 | 23 | Function name: buzzer_on() | 
| Stumi | 6:2cc2aac35868 | 24 | Input Parameters: N/A | 
| Stumi | 6:2cc2aac35868 | 25 | Output Parameters: N/A | 
| Stumi | 6:2cc2aac35868 | 26 | Description: Turns the buzzer on indefinitely | 
| Stumi | 6:2cc2aac35868 | 27 | ----------------------------------------------------------------------------------*/ | 
| Stumi | 6:2cc2aac35868 | 28 | void cBuzzer::buzzer_on() | 
| Stumi | 6:2cc2aac35868 | 29 | { | 
| Stumi | 6:2cc2aac35868 | 30 | _Buzz = 1; //Enable Buzzer | 
| Stumi | 6:2cc2aac35868 | 31 | } | 
| Stumi | 6:2cc2aac35868 | 32 | |
| Stumi | 6:2cc2aac35868 | 33 | /*-------------------------------------------------------------------------------- | 
| Stumi | 6:2cc2aac35868 | 34 | Function name: buzz_off() | 
| Stumi | 6:2cc2aac35868 | 35 | Input Parameters: N/A | 
| Stumi | 6:2cc2aac35868 | 36 | Output Parameters: N/A | 
| Stumi | 6:2cc2aac35868 | 37 | Description: Turns buzzer off indefinitely | 
| Stumi | 6:2cc2aac35868 | 38 | ----------------------------------------------------------------------------------*/ | 
| Stumi | 6:2cc2aac35868 | 39 | void cBuzzer::buzz_off() | 
| Stumi | 6:2cc2aac35868 | 40 | { | 
| Stumi | 6:2cc2aac35868 | 41 | _Buzz = 0; //Disable Buzzer | 
| Stumi | 6:2cc2aac35868 | 42 | } |