first draft

Dependencies:   mbed

Revision:
0:5c74277dcb15
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Mar 16 00:30:42 2016 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+
+InterruptIn encoder(////);
+
+int count = 0;
+int stopCount = 10;
+Timer t;
+float time;
+float countPerSec = 0.0;
+
+void increment() {
+    count += 1;
+}
+
+int main() {
+    encoder.rise(&increment);
+    while(1) {
+        if (count >= stopCount) {
+            t.stop();
+            time = t.read();
+            countPerSec = float(stopCount) / time;
+            count = 0;
+            t.reset();
+            t.start();
+        }
+
+    }
+}