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
--- /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
--- /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