BE@R lab / motion_control

Dependencies:   motor_relay

Dependents:   dog_V3_3_testmotor

Revision:
9:e3895130e56f
Parent:
7:94518aee126b
--- a/motion_control.cpp	Fri Jul 24 21:15:45 2015 +0000
+++ b/motion_control.cpp	Mon Dec 07 09:15:37 2015 +0000
@@ -30,12 +30,16 @@
                 motor.StopMotor();
             }
         } else {
-            motor.SetMotor(dirction);
+             motor.StopMotor();
+            return 1;
         }
         return 0;//Normally
     } else if(_limit_down) {
-        motor.SetMotor(1);
-        // }
+        if(mode_limit == 0) {
+            motor.SetMotor(1);
+        } else {
+            motor.StopMotor();
+        }
         return -1;
     } else {
         motor.SetMotor(dirction);
@@ -119,7 +123,7 @@
         sum += _position.read_u16();
     }
     MIN_POSITION = sum/LOOP;
-    
+
     SetMode(buff);
 }