program for receiving 2021NHK B_team controller

Dependencies:   2021Bcon

Revision:
0:157b6d43eb95
Child:
1:0cc19b454fc6
diff -r 000000000000 -r 157b6d43eb95 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Oct 16 05:25:59 2021 +0000
@@ -0,0 +1,23 @@
+#include "controller.h"
+#include "pinconfig.h"
+
+Bcon mycon(fepTX, fepRX, fepad);
+Serial pc(pcTX, pcRX, 115200);
+
+int main()
+{
+    mycon.StartReceive();
+    uint8_t b[8];
+    int16_t stick[4];
+    while(1) {
+        for (int i=0; i<8; i++) b[i] = mycon.getButton(i);
+        for (int i=0; i<4; i++) stick[i] = mycon.getStick(i);
+        
+        for (int i=0; i<8; i++) pc.printf("%d ", b[i]);
+        pc.printf(" | ");
+        for (int i=0; i<4; i++) pc.printf("%3d ", stick[i]);
+        pc.printf(" | ");
+        if (mycon.status) pc.printf("OK\r\n");
+        else pc.printf("ERROR\r\n");
+    }
+}
\ No newline at end of file