InterruptIn

Fork of InterruptIn_HelloWorld by mbed_example

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Fri Feb 15 15:13:19 2013 +0000
Child:
1:e0f221b58791
Commit message:
Hello World for InteruptIn

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	Fri Feb 15 15:13:19 2013 +0000
@@ -0,0 +1,17 @@
+#include "mbed.h"
+ 
+InterruptIn button(p5);
+DigitalOut led(LED1);
+DigitalOut flash(LED4);
+ 
+void flip() {
+    led = !led;
+}
+ 
+int main() {
+    button.rise(&flip);  // attach the address of the flip function to the rising edge
+    while(1) {           // wait around, interrupts will interrupt this!
+        flash = !flash;
+        wait(0.25);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Feb 15 15:13:19 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/0954ebd79f59
\ No newline at end of file