Delong Qi
/
LinkNode_Buzzer
LinkNode_Buzzer
Fork of mbed_blinky by
Revision 11:de89a91b9440, committed 2016-04-13
- Comitter:
- helloqi
- Date:
- Wed Apr 13 12:32:51 2016 +0000
- Parent:
- 10:3e42ca878d11
- Commit message:
- LinkNode_Buzzer
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 3e42ca878d11 -r de89a91b9440 main.cpp --- a/main.cpp Sun Jan 17 03:25:27 2016 +0000 +++ b/main.cpp Wed Apr 13 12:32:51 2016 +0000 @@ -1,12 +1,20 @@ #include "mbed.h" -DigitalOut myled(LED1); +DigitalOut buzzer(P0_22); +InterruptIn btn(P0_29); -int main() { - while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); - } +void beep(void) +{ + for(int i=0;i<20;i++) + { + buzzer = 1; + wait_ms(1); + buzzer = 0; + wait_ms(1); + } } +int main() +{ + btn.rise(&beep); + while(1); +}