LinkNode_Buzzer

Dependencies:   mbed

Fork of mbed_blinky by Mbed

Files at this revision

API Documentation at this revision

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
--- 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);
+}