programming an Arduino to stop a gear-box motor with DC motor driver

How would I go about programming an Arduino to stop a gear-box motor with DC motor driver after a certain amount of time has passed?
please help me
regards

this my code

IBT-2 Motor Control Board driven by Arduino.
Speed and direction are separated in two functions.
Connection to the IBT-2 board:
IBT-2 pin 1 (RPWM) to Arduino pin 5(PWM)
IBT-2 pin 2 (LPWM) to Arduino pin 6(PWM)
IBT-2 pin 8 (GND) to Arduino GND
IBT-2 pins 5 (R_IS) and 6 (L_IS) not connected
*/

int RPWM_Output = 5; // Arduino PWM output pin 5; connect to IBT-2 pin 1 (RPWM)
int LPWM_Output = 6; // Arduino PWM output pin 6; connect to IBT-2 pin 2 (LPWM)
int reversePWM;
int forwardPWM;
long startTime,stopTime;
long myDesiredTime;
void setup()
{
pinMode(RPWM_Output, OUTPUT);
pinMode(LPWM_Output, OUTPUT);
void loop()
{
// reverse rotation
for ( reversePWM=0;reversePWM<255;reversePWM++)
{

analogWrite(LPWM_Output, 0);
analogWrite(RPWM_Output, reversePWM);
}
delay(700);
// forward rotation
for ( forwardPWM=0;forwardPWM<255;forwardPWM++)
{
analogWrite(LPWM_Output, forwardPWM);
analogWrite(RPWM_Output, 0);
}
delay(700);

You have not told us what your program actually does and what you want it to do that is different.

It is usually not a good idea to use delay() for timing except in a simple demo program because delay() blocks the Arduino from doing other things until it completes.

Have a look at how millis() is used to manage timing without blocking in Several things at a time.

Also, to make it easy for people to help you please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum

...R

Makes a difference if you want an instantaneous stop or a deceleration to a stop.

Paul

Paul_KD7HB:
Makes a difference if you want an instantaneous stop or a deceleration to a stop.

Paul

How can I do that

gatea:
How can I do that

I'm guessing you did not write the program?

To quickly stop the motor, set the PWM to zero. To decelerate, use the code in the program and then set the PWM to zero.

Paul