El-POM1001 / Mbed 2 deprecated LAB03_Oppgave2

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
madmonkeyman82
Date:
Thu Oct 15 15:54:42 2015 +0000
Commit message:
first

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
diff -r 000000000000 -r c7377fa95fab main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Oct 15 15:54:42 2015 +0000
@@ -0,0 +1,44 @@
+#include "mbed.h"
+
+InterruptIn SW7(PB_3);
+InterruptIn SW6(PA_10);
+
+Timer timer;
+
+void startKlokke();
+void stoppKlokke();
+void print();
+
+int main() 
+{    
+    
+    printf("Velkommen\n");
+
+    SW7.fall(&startKlokke);
+    SW6.fall(&stoppKlokke);
+
+    while(1) 
+    {
+        
+    }
+    
+}
+void startKlokke()
+{
+   timer.reset();
+   timer.start();        
+}
+    
+void stoppKlokke()
+{
+    timer.stop();
+    print();   
+}
+
+void print()
+{
+    float tidSek=timer.read();
+    float hastighet = (5/tidSek)*3.6;
+    
+    printf("Hastighet %.2f Km\\t\r\n", hastighet); 
+}
\ No newline at end of file
diff -r 000000000000 -r c7377fa95fab mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Oct 15 15:54:42 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/ba1f97679dad
\ No newline at end of file