Éric Bisson / Mbed 2 deprecated S5info_APP4

Dependencies:   mbed-rtos mbed CRC16

Fork of S5info_APP2 by Éric Bisson

Revision:
14:bd909277eb13
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/read.h	Tue Mar 07 04:39:57 2017 +0000
@@ -0,0 +1,26 @@
+#include "mbed.h"
+#include "rtos.h"
+DigitalIn in(p30);
+Thread ThreadLecture;
+const int PREAMBULE = 0b01010101;
+const int START = 0b01111110;
+const int END = 0b01111110;
+
+void read()
+{
+    char byte;
+    vector<char> bytes;
+    while (true)
+    {
+        ThreadLecture.signal_wait(1);
+        
+        byte = (byte << 1) + in;
+        
+        shift++;
+        if (shift == 8)
+        {
+            bytes.push_back(byte);
+            shift = 0;
+        }
+    }
+}
\ No newline at end of file