trtr

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
simwiu
Date:
Thu Nov 12 10:59:22 2015 +0000
Commit message:
fsd

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 Nov 12 10:59:22 2015 +0000
@@ -0,0 +1,48 @@
+#include "mbed.h"
+
+InterruptIn SW7(PB_3);
+InterruptIn SW6(PA_10);
+    static double tidSek;
+    //static double meter=5;
+    //static double kmh=3.6;
+    //static double v;
+      
+    Timer timer;
+    
+    void startKlokke()
+    {
+    timer.reset();
+    timer.start();
+    }
+
+    void stopKlokke()
+    {
+    timer.stop();
+    tidSek=timer.read_ms()/1000.0;
+    //v=meter/tidSek*kmh;
+
+    
+    printf("Km/t %.3f \r\n", 5/tidSek*3.6 );
+    }
+
+    int main ()
+{
+    
+    SW7.fall(&startKlokke);
+    SW6.fall(&stopKlokke);     
+     
+    
+
+    while (true)
+    {     
+    timer.reset();
+    while (SW7==1){;};
+    timer.start();
+    while (SW6==1){;};
+    timer.stop();
+           
+         
+           wait_ms(200);
+           
+    }
+}     
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 12 10:59:22 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/ba1f97679dad
\ No newline at end of file