Robot Bachelor / Mbed 2 deprecated MC

Dependencies:   mbed-rtos mbed PinDetect

Fork of FinalMotorControl by Robot Bachelor

Files at this revision

API Documentation at this revision

Comitter:
mjhaugsdal
Date:
Tue Apr 26 13:43:03 2016 +0000
Parent:
12:de8381ca371d
Child:
14:c3d1689dccf8
Commit message:
Put two engines in same thread, but counting steps

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Apr 26 13:39:14 2016 +0000
+++ b/main.cpp	Tue Apr 26 13:43:03 2016 +0000
@@ -55,7 +55,34 @@
     wait_us(fart);
 }
 */
+void step4Right2()
+{
 
+   //engine 2
+    IN5=0;
+    IN6=1;
+    IN7=0;
+    IN8=1;
+    wait_us(fart);
+    //engine 2
+    IN5=0;
+    IN6=1;
+    IN7=1;
+    IN8=0;
+    wait_us(fart);
+    //engine 2
+    IN5=1;
+    IN6=0;
+    IN7=1;
+    IN8=0;
+    wait_us(fart);
+    //engine 2
+    IN5=1;
+    IN6=0;
+    IN7=0;
+    IN8=1;
+    wait_us(fart);
+}
 
 void step4Right1()
 {
@@ -120,7 +147,38 @@
 }
 
 */
+void step4Left2()
+{
+    //engine 2
+    IN5=1;
+    IN6=0;
+    IN7=0;
+    IN8=1;
+    wait_us(fart);
 
+    
+    //engine 2
+    IN5=1;
+    IN6=0;
+    IN7=1;
+    IN8=0;
+    wait_us(fart);
+    
+    //engine 2
+    IN5=0;
+    IN6=1;
+    IN7=1;
+    IN8=0;
+    wait_us(fart);
+    
+    //engine 2
+    IN5=0;
+    IN6=1;
+    IN7=0;
+    IN8=1;
+    wait_us(fart);
+    
+}
 
 void step4Left1()
 {
@@ -156,68 +214,6 @@
 
 void motor2(void const *args)
 {
-    void step4Right2()
-{
-
-   //engine 2
-    IN5=0;
-    IN6=1;
-    IN7=0;
-    IN8=1;
-    wait_us(fart);
-    //engine 2
-    IN5=0;
-    IN6=1;
-    IN7=1;
-    IN8=0;
-    wait_us(fart);
-    //engine 2
-    IN5=1;
-    IN6=0;
-    IN7=1;
-    IN8=0;
-    wait_us(fart);
-    //engine 2
-    IN5=1;
-    IN6=0;
-    IN7=0;
-    IN8=1;
-    wait_us(fart);
-}
-
-void step4Left2()
-{
-    //engine 2
-    IN5=1;
-    IN6=0;
-    IN7=0;
-    IN8=1;
-    wait_us(fart);
-
-    
-    //engine 2
-    IN5=1;
-    IN6=0;
-    IN7=1;
-    IN8=0;
-    wait_us(fart);
-    
-    //engine 2
-    IN5=0;
-    IN6=1;
-    IN7=1;
-    IN8=0;
-    wait_us(fart);
-    
-    //engine 2
-    IN5=0;
-    IN6=1;
-    IN7=0;
-    IN8=1;
-    wait_us(fart);
-    
-}
-    
     while(true)
     {
         if(m_cmd == 't')
@@ -323,16 +319,17 @@
                 while (steps1 >= 0)
                 {
                     step4Left1();
-                    //step4Left2();
+                    step4Left2();
                     //step4Left3();
                     steps1--;
                 }
+                /*
                 while (steps2 >= 0)
                 {
                     step4Left2();
             
                     steps2--;
-                }
+                } */
                 m_cmd = 'x';
             }
             else if (m_cmd == 'l')
@@ -342,7 +339,7 @@
                 while (steps >= 0)
                 {
                     step4Right1();
-                    //step4Right2(); 
+                    step4Right2(); 
                     //step4Right3();
                     steps--;
                 }