Timer demo

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ethanharstad
Date:
Mon Jun 02 06:47:30 2014 +0000
Commit message:
Initial commit

Changed in this revision

Timer.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 1d3fd5616c0a Timer.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Timer.cpp	Mon Jun 02 06:47:30 2014 +0000
@@ -0,0 +1,16 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX);
+DigitalIn btn(USER_BUTTON);
+Timer t;
+
+int main() {
+    while(true) {
+        while(btn != 0);
+        t.start();
+        while(btn != 1);
+        t.stop();
+        pc.printf("%i us\n", t.read_us());
+        t.reset();
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 1d3fd5616c0a mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jun 02 06:47:30 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877
\ No newline at end of file