SerialArduino

Dependencies:   SerialArduino

Revision:
0:816cb0f3dcd4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jun 07 04:10:29 2022 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+#include "SerialArduino.h"
+
+SerialArduino mini(PC_10,PC_11,115200);
+BufferedSerial pc(USBTX,USBRX,115200);
+
+int main()
+{
+    uint8_t h1,h2,i;
+    bool b[12]={0};
+    uint8_t t[2],s[4];
+    char CRLF[3] = "\r\n";
+    while(1)
+    {
+        h1 = mini.getHedder1();
+        h2 = mini.getHedder2();
+        for(i=0;i<12;i++)
+        {
+            b[i] = mini.getButton(i);
+            printf("%d ",b[i]);
+        }
+        printf("|");
+        for(i=0;i<2;i++)
+        {
+            t[i] = mini.getTrigger(i);
+            printf("%3d ",t[i]);
+        }
+        printf("|");
+        for(i=0;i<4;i++)
+        {
+            s[i] = mini.getStick(i);
+            printf("%3d ",s[i]);
+        }
+//        printf("%d",mini.getRawButton());
+        
+        if(mini.getState()) printf("ok");
+        else printf("bad");
+        printf("\r\n");
+        thread_sleep_for(10);
+        
+    }
+}
\ No newline at end of file