Robotics Term Project / Mbed 2 deprecated Robottics_Motion

Dependencies:   mbed

Revision:
22:d7b98234291c
Parent:
21:6e8ab9487985
Child:
23:948ce071cbb6
--- a/AI_Friday.cpp	Wed May 25 16:59:05 2016 +0000
+++ b/AI_Friday.cpp	Thu May 26 00:33:51 2016 +0000
@@ -238,17 +238,37 @@
                 case 1:
                     funcBorder();
                     break;
-                case 2: // 前進、後退 再判別
+                case 2: // 前進 再判別   v1+  v2-
+                    if((borAngle-angleC)> 5 || (borAngle-angleC)<-5)
+                    {
+                        v1_ref =  100;
+                        v2_ref = -100;    
+                    }
+                    bor_state = 1;
                     break;
-                case 3: // 順時轉到特定角 結束
+                case 3: // 後退 再判別   v1-  v2+
+                    if((borAngle-angleC)> 5 || (borAngle-angleC)<-5)
+                    {
+                        v1_ref =  100;
+                        v2_ref = -100;    
+                    }
+                    bor_state = 1;
+                    break;
+                case 4: // 順時轉到特定角 結束  v1-- v2 --
+                    if((borAngle-angleC)> 5 || (borAngle-angleC)<-5)
+                    {
+                        v1_ref = -100;
+                        v2_ref = -100;    
+                    }
                     
                     break;
-                case 4: // 逆時轉到特定角 結束
+                case 5: // 逆時轉到特定角 結束  v1 ++   v2++
                     
                     break;
-                case 5:  //結束
+                case 6:  //結束
                     borAngle = 0;
                     aI_State = 2;
+                    bor_state = 1;
                     break;
                 
                 }