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.
Fork of ESDC2014 by
Diff: buzzer.cpp
- Revision:
- 1:cbec1283a16a
- Parent:
- 0:3417ca0a36c0
- Child:
- 2:442902ec3aa1
--- a/buzzer.cpp Tue Jul 01 10:59:33 2014 +0000 +++ b/buzzer.cpp Thu Jul 03 03:56:29 2014 +0000 @@ -31,17 +31,56 @@ Buzzer::Buzzer(MyDigitalOut* buzzer) { this->_buzzer = buzzer; - *_buzzer = 1; + ON(); + wait(0.1); + OFF(); + wait(0.1); + ON(); + wait(0.1); + OFF(); + wait(0.1); + ON(); + wait(0.2); + OFF(); } Buzzer::~Buzzer(){} -void Buzzer::buzzerON() +void Buzzer::ON() { *_buzzer = 0; } -void Buzzer::buzzerOFF() +void Buzzer::OFF() { *_buzzer = 1; -} \ No newline at end of file +} + +void Buzzer::setFlag() +{ + flag=1; +} + +void Buzzer::cleanFlag() +{ + flag=0; +} + +void Buzzer::check_time_out() +{ + if(flag == 1) + { + ON(); + } + else + { + OFF(); + } +} + +void Buzzer::time_out_init() +{ + setFlag(); + time_out.detach(); + time_out.attach(this, &Buzzer::check_time_out, TIME_OUT); +}