Interrupt

Dependencies:   mbed

Revision:
0:6643d1c94bd0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Oct 15 10:53:41 2015 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+
+InterruptIn SW7(PB_3);
+InterruptIn SW6(PA_10);
+
+Timer timer;
+static double tidSek;
+
+void startKlokke()
+{
+    timer.reset();
+    timer.start();
+}
+
+void stopKlokke()
+{
+    timer.stop();
+    tidSek=timer.read_ms()/1000.0;
+    printf("tid %.3f sek\r\n", tidSek);
+}
+
+int main() 
+{   
+    SW7.fall(&startKlokke);
+    SW6.fall(&stopKlokke);
+    
+    while (true) 
+    {   
+        wait_ms(200); 
+    }
+}
\ No newline at end of file