interrupt

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
kaushalpkk
Date:
Thu Jun 28 20:18:29 2018 +0000
Commit message:
init!

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jun 28 20:18:29 2018 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h"
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+InterruptIn button(p30);
+
+void flip() {
+    wait(0.5);    
+    led2 = !led2;
+    printf("Interrupted!!\n");
+}
+ 
+int main() {
+    button.rise(&flip);  // attach the address of the flip function to the rising edge
+    while(1) {
+        led1 = !led1;
+        wait(1);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jun 28 20:18:29 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/5aab5a7997ee
\ No newline at end of file