motor instructions sequence

hi all,

any idea about the ideal intructions sequence to properly manage a motor?

i have arduino uno board + arduino motor shield + DC motor 2-6V.

for now i am using this instructions sequence to start the motor:

  • brake off
  • direction left
  • speed 200

then after a while comes another instructions sequence to change direction and speed:

  • brake on
  • direction right
  • brake off
  • speed 250

the motor is gently following the above instructions sequences but is this the correct way to instruct the motor? i am not asking about the code but about the sequence. for instance, in the second sequence you see brake on + … + break off, and i am wondering if this is the correct way.

thank you for your help.

I think you should reverse these two lines

  • direction right
  • brake off

this worked for me

void setup() {
  
  //Setup Channel A
  pinMode(12, OUTPUT); //Initiates Motor Channel A pin
  pinMode(9, OUTPUT); //Initiates Brake Channel A pin
  
}

void loop(){
  
 digitalWrite(12, HIGH); //Establishes forward direction of motor
  digitalWrite(9, LOW);   //Disengage the Brake for motor
  analogWrite(3, 255);   //Spins the motor on motor at full speed
  
  delay(7550);
  
  digitalWrite(9, HIGH); //Eengage the Brake for motor

  delay(500);
  
  
    
  }
}

Hi, when you give the brake ON, does it tell the motor to STOP, or are you putting the brake ON while the motor is still being powered? Tom.

If the motor will be attached to a gear box, the electronic braking is largely irrelevant in small systems.