One motor stops faster then another

else {

    while ((motorSpeed2 > targetSpeed2 || motorSpeed1 > targetSpeed) || (motorSpeed4 > targetSpeed4 || motorSpeed3 > targetSpeed3)) {
      motorSpeed2 -= 1.2;
      motorSpeed1--;
      motorSpeed4--;
      motorSpeed3--;

      if (motorSpeed4 < targetSpeed4) {
        motorSpeed4 = targetSpeed4;
      }
      if (motorSpeed3 < targetSpeed3) {
        motorSpeed3 = targetSpeed3;
      }
      if (motorSpeed2 < targetSpeed2) {
        motorSpeed2 = targetSpeed2;
      }
      if (motorSpeed1 < targetSpeed) {
        motorSpeed1 = targetSpeed;
      }

      analogWrite(5, motorSpeed2);
      analogWrite(3, motorSpeed1);
      analogWrite(6, motorSpeed4);
      analogWrite(4, motorSpeed3);
      delay(10);
    }
    
  }

used this code, but motor on pin 4 stops faster somehow
I won't show entire code, cuz this will be enough & one part(where *1.2) works correctly
so far if you say to increase decreement - I already tried and haven't succeeded(

All physical devices are different, requiring code adjustment.

You should. You wouldn't be asking questions if it all worked.

1 Like

You will figure it out.....
Swap motors and see what happens...

1 Like

No sale.

1 Like