I attached the motor with Motor Driver and Uno 3. Can you please complete the code below ? I want to add the starting lines. Please define pins.
void setup() {
//Setup Channel A
pinMode(12, OUTPUT); //Initiates Motor Channel A pin
pinMode(9, OUTPUT); //Initiates Brake Channel A pin
}
void loop(){
//forward @ full speed
digitalWrite(12, HIGH); //Establishes forward direction of Channel A
digitalWrite(9, LOW); //Disengage the Brake for Channel A
analogWrite(3, 255); //Spins the motor on Channel A at full speed
delay(3000);
digitalWrite(9, HIGH); //Eengage the Brake for Channel A
delay(1000);
//backward @ half speed
digitalWrite(12, LOW); //Establishes backward direction of Channel A
digitalWrite(9, LOW); //Disengage the Brake for Channel A
analogWrite(3, 123); //Spins the motor on Channel A at half speed
delay(3000);
digitalWrite(9, HIGH); //Eengage the Brake for Channel A
delay(1000);
}
I connected GND to UNO GND
DIR to pin 12
PWM to pin 3 of UNo 3.
Break to pin 8