Controlling the motor in both directions
Hello everyone,
I'm currently working on a project where I'm trying to control a motor in both directions. However, when switching from one direction to another, there is a delay which I would like to remove.
Here is the current code that I'm using:
MC_ProgramSpeedRampMotor1(700/6, 3000);
MC_StartMotor1();
HAL_DELAY(8000);
MC_STopMotor1();
HAL_DELAY(2000);
MC_ProgramSpeedRampMotor1(-700/6, 3000);
MC_StartMotor1();
HAL_DELAY(8000);
MC_STopMotor1();
HAL_DELAY(2000);As you can see, after stopping the motor, I need to add a delay before starting it again in the opposite direction. However, I would like to switch between the two directions immediately without any delay.
I'm aware that the motor needs a start-up time to begin rotating, but I'm wondering if there is a way to switch between the two directions directly without any delay. Note: If I remove the delay of 2000ms then the motor won't switch its direction.
If anyone has any ideas or suggestions, please let me know. Thank you in advance for your help!
