Program that uses the EOF sequence of Vizualeyez motion tracker to trigger an output.

Dependencies:   mbed

Revision:
0:6190ebfd8112
Child:
1:381c49f999b8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Oct 27 07:15:49 2016 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+
+DigitalOut gpo(D0);
+DigitalOut led(LED_RED);
+
+InterruptIn trig(PTD1);
+Timer trigtimer;
+Timeout output_timeout;
+
+
+void set_output(void)
+{
+    gpo.write(1);
+}
+
+
+void trig_rise_event(void)
+{
+    trigtimer.reset();
+}
+
+
+void trig_fall_event(void)
+{
+    if(trigtimer.read_us() > 400)
+    {
+        gpo.write(0);
+        output_timeout.attach_us(set_output, 1000);
+    }
+}    
+
+int main()
+{
+    trigtimer.start();
+    trig.rise(trig_rise_event);
+    trig.fall(trig_fall_event);
+    while (true) {
+        //gpo = !gpo; // toggle pin
+        led = !led; // toggle led
+        wait(0.2f);
+    }
+}
\ No newline at end of file