serial arduino controller

Dependents:   serial_arduino 300_PS3Dribbler 300_PS3com Quadrifoglio_PS3COM

Revision:
2:3b34130dfdd2
Parent:
1:36350a60662e
diff -r 36350a60662e -r 3b34130dfdd2 SerialArduino.cpp
--- a/SerialArduino.cpp	Fri Jun 17 06:05:57 2022 +0000
+++ b/SerialArduino.cpp	Fri Jun 17 06:24:01 2022 +0000
@@ -10,29 +10,31 @@
 
 void SerialArduino::serialLoop()
 {
-    mini.read(&hedder1,1);
-    mini.read(&hedder2,1);
-//    mini.read(buff,1);
-//    checkSum = atoi(&buff[2]);
-    if(hedder1==0xff 
-    && hedder2==0xee 
-    )
-    {
-//        mini.read(&button,2);
-        mini.read(&b0,1);
-        mini.read(&b1,1);
-        mini.read(&trigger[0],1);
-        mini.read(&trigger[1],1);
-        mini.read(&stick[0],1);
-        mini.read(&stick[1],1);
-        mini.read(&stick[2],1);
-        mini.read(&stick[3],1);
-//        mini.read(&checkSum,1);
-        mini.read(&timeout,1);
-
+    while (1) {
+        mini.read(&hedder1,1);
+        mini.read(&hedder2,1);
+    //    mini.read(buff,1);
+    //    checkSum = atoi(&buff[2]);
+        if(hedder1==0xff 
+        && hedder2==0xee 
+        )
+        {
+    //        mini.read(&button,2);
+            mini.read(&b0,1);
+            mini.read(&b1,1);
+            mini.read(&trigger[0],1);
+            mini.read(&trigger[1],1);
+            mini.read(&stick[0],1);
+            mini.read(&stick[1],1);
+            mini.read(&stick[2],1);
+            mini.read(&stick[3],1);
+    //        mini.read(&checkSum,1);
+            mini.read(&timeout,1);
+    
+        }
+//        mini.write(CRLF,2);
+//        ThisThread::sleep_for(1);
     }
-    mini.write(CRLF,2);
-    ThisThread::sleep_for(1);
 
 }