A digital input monitoring implementation with an interrupt.

Revision:
0:501aab314b48
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Sep 26 16:26:06 2016 +0000
@@ -0,0 +1,17 @@
+#include "mbed.h"
+ 
+InterruptIn button(SW1);
+DigitalOut led(LED1);
+DigitalOut heartbeat(LED2);
+ 
+void toggle() {
+    led = !led;
+}
+ 
+int main() {
+    button.rise(&toggle);  // call toggle function on the rising edge
+    while(1) {           // wait around, interrupts will interrupt this!
+        heartbeat= !heartbeat;
+        wait(0.25);
+    }
+}
\ No newline at end of file