AirsoftTimer software based on mbed
Dependencies: mbed TextLCD keypad
board/Buzzer.cpp@27:f29805113454, 2017-02-09 (annotated)
- Committer:
- sillevl
- Date:
- Thu Feb 09 12:28:56 2017 +0000
- Revision:
- 27:f29805113454
- Parent:
- 11:50572814f73e
ARCHIVE WIP, not working (crashes, cause unknown)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sillevl | 4:2c91c9eccf3a | 1 | #include "Buzzer.h" |
sillevl | 10:afc22465169e | 2 | #include "mbed.h" |
sillevl | 4:2c91c9eccf3a | 3 | |
sillevl | 11:50572814f73e | 4 | Buzzer::Buzzer(PinName buzzerPin) : out(buzzerPin){ |
sillevl | 11:50572814f73e | 5 | out = 0.0; |
sillevl | 5:be598835bab0 | 6 | } |
sillevl | 5:be598835bab0 | 7 | |
sillevl | 5:be598835bab0 | 8 | void Buzzer::startupBeep(){ |
sillevl | 5:be598835bab0 | 9 | |
sillevl | 11:50572814f73e | 10 | } |
sillevl | 11:50572814f73e | 11 | |
sillevl | 11:50572814f73e | 12 | void Buzzer::playNote(float frequency, float duration, float volume){ |
sillevl | 11:50572814f73e | 13 | out.period(1.0/frequency); |
sillevl | 11:50572814f73e | 14 | out = volume/2.0; |
sillevl | 11:50572814f73e | 15 | wait_ms(duration); |
sillevl | 11:50572814f73e | 16 | out = 0.0; |
sillevl | 4:2c91c9eccf3a | 17 | } |