Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:c7377fa95fab
--- /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