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.
beep.cpp@4:ae81aeeed069, 2018-11-15 (annotated)
- Committer:
- hyunsungkim
- Date:
- Thu Nov 15 07:28:39 2018 +0000
- Revision:
- 4:ae81aeeed069
- Parent:
- 3:690740ab3394
- Child:
- 5:ad66d64c3d33
Before changing buzzer pwm to softpwm
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| hyunsungkim | 3:690740ab3394 | 1 | #include "beep.h" | 
| hyunsungkim | 3:690740ab3394 | 2 | |
| hyunsungkim | 3:690740ab3394 | 3 | extern PwmOut buzzer; | 
| hyunsungkim | 3:690740ab3394 | 4 | |
| hyunsungkim | 3:690740ab3394 | 5 | void beepStart() | 
| hyunsungkim | 3:690740ab3394 | 6 | { | 
| hyunsungkim | 3:690740ab3394 | 7 | buzzer.write(0.5); | 
| hyunsungkim | 3:690740ab3394 | 8 | buzzer.period_us(1000000/Do5); | 
| hyunsungkim | 3:690740ab3394 | 9 | wait(0.1); | 
| hyunsungkim | 3:690740ab3394 | 10 | buzzer.period_us(1000000/Mi5); | 
| hyunsungkim | 3:690740ab3394 | 11 | wait(0.1); | 
| hyunsungkim | 3:690740ab3394 | 12 | buzzer.period_us(1000000/So5); | 
| hyunsungkim | 3:690740ab3394 | 13 | wait(0.1); | 
| hyunsungkim | 4:ae81aeeed069 | 14 | buzzer.write(1); | 
| hyunsungkim | 3:690740ab3394 | 15 | } | 
| hyunsungkim | 3:690740ab3394 | 16 | |
| hyunsungkim | 3:690740ab3394 | 17 | void beepAfterset() | 
| hyunsungkim | 3:690740ab3394 | 18 | { | 
| hyunsungkim | 3:690740ab3394 | 19 | buzzer.write(0.5); | 
| hyunsungkim | 3:690740ab3394 | 20 | buzzer.period_us(1000000/Do5); | 
| hyunsungkim | 3:690740ab3394 | 21 | wait(0.1); | 
| hyunsungkim | 3:690740ab3394 | 22 | buzzer.period_us(1000000/Mi5); | 
| hyunsungkim | 3:690740ab3394 | 23 | wait(0.1); | 
| hyunsungkim | 3:690740ab3394 | 24 | buzzer.period_us(1000000/So5); | 
| hyunsungkim | 3:690740ab3394 | 25 | wait(0.1); | 
| hyunsungkim | 4:ae81aeeed069 | 26 | buzzer.write(1); | 
| hyunsungkim | 3:690740ab3394 | 27 | buzzer.write(0.5); | 
| hyunsungkim | 3:690740ab3394 | 28 | buzzer.period_us(1000000/Re5); | 
| hyunsungkim | 3:690740ab3394 | 29 | wait(0.1); | 
| hyunsungkim | 3:690740ab3394 | 30 | buzzer.period_us(1000000/Fa5); | 
| hyunsungkim | 3:690740ab3394 | 31 | wait(0.1); | 
| hyunsungkim | 3:690740ab3394 | 32 | buzzer.period_us(1000000/La5); | 
| hyunsungkim | 3:690740ab3394 | 33 | wait(0.1); | 
| hyunsungkim | 4:ae81aeeed069 | 34 | buzzer.write(1); | 
| hyunsungkim | 3:690740ab3394 | 35 | buzzer.write(0.5); | 
| hyunsungkim | 3:690740ab3394 | 36 | buzzer.period_us(1000000/Mi5); | 
| hyunsungkim | 3:690740ab3394 | 37 | wait(0.1); | 
| hyunsungkim | 3:690740ab3394 | 38 | buzzer.period_us(1000000/So5); | 
| hyunsungkim | 3:690740ab3394 | 39 | wait(0.1); | 
| hyunsungkim | 3:690740ab3394 | 40 | buzzer.period_us(1000000/Ti5); | 
| hyunsungkim | 3:690740ab3394 | 41 | wait(0.2); | 
| hyunsungkim | 4:ae81aeeed069 | 42 | buzzer.write(1); | 
| hyunsungkim | 3:690740ab3394 | 43 | } | 
| hyunsungkim | 3:690740ab3394 | 44 | |
| hyunsungkim | 3:690740ab3394 | 45 | void beepEnd() | 
| hyunsungkim | 3:690740ab3394 | 46 | { | 
| hyunsungkim | 3:690740ab3394 | 47 | buzzer.write(0.5); | 
| hyunsungkim | 3:690740ab3394 | 48 | buzzer.period_us(1000000/So5); | 
| hyunsungkim | 3:690740ab3394 | 49 | wait(0.1); | 
| hyunsungkim | 3:690740ab3394 | 50 | buzzer.period_us(1000000/Mi5); | 
| hyunsungkim | 3:690740ab3394 | 51 | wait(0.1); | 
| hyunsungkim | 3:690740ab3394 | 52 | buzzer.period_us(1000000/Do5); | 
| hyunsungkim | 3:690740ab3394 | 53 | wait(0.1); | 
| hyunsungkim | 3:690740ab3394 | 54 | buzzer.write(0); | 
| hyunsungkim | 3:690740ab3394 | 55 | } |