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);