AirsoftTimer software based on mbed
Dependencies: mbed TextLCD keypad
Diff: board/Buzzer.cpp
- Revision:
- 11:50572814f73e
- Parent:
- 10:afc22465169e
--- a/board/Buzzer.cpp Sun Dec 14 11:50:19 2014 +0000 +++ b/board/Buzzer.cpp Wed Dec 31 15:27:43 2014 +0000 @@ -1,11 +1,17 @@ #include "Buzzer.h" #include "mbed.h" -Buzzer::Buzzer(PinName buzzerPin){ - DigitalOut buzzer(buzzerPin); - buzzer = 0; +Buzzer::Buzzer(PinName buzzerPin) : out(buzzerPin){ + out = 0.0; } void Buzzer::startupBeep(){ +} + +void Buzzer::playNote(float frequency, float duration, float volume){ + out.period(1.0/frequency); + out = volume/2.0; + wait_ms(duration); + out = 0.0; } \ No newline at end of file