my new gear...

Dependencies:   mbed

Revision:
10:b64f586efb2d
Parent:
8:1ca5a2052b0c
Child:
21:72dcbbfeb5d8
--- a/actuator/IMC_motorDrive.cpp	Fri Jun 10 08:09:09 2022 +0000
+++ b/actuator/IMC_motorDrive.cpp	Fri Jun 10 08:54:32 2022 +0000
@@ -6,6 +6,9 @@
 }
 
 void IMC_motor::IMCdrive(double target){
+    if(cw_flag){
+        target = -target;    
+    }
     drive((int)imc_out(target));
 }
 
@@ -16,9 +19,6 @@
 
 void IMC_motor::drive(int pwm){
     float output_pwm = constrain(pwm,-200,200)/255;
-    if(cw_flag){
-        pwm = -pwm;    
-    }
     if(!pwm) {
         DigitalOut Moter1(motor.pin[0],0);
         DigitalOut Moter2(motor.pin[1],0);