I'm trying to figure out if I can change the speed of the motor midway through. I'm not really sure what any of this means.
// Definitions Arduino pins connected to input H Bridge
int enA = 9;
int enB = 11;
int Speed1 = 50;
int Speed2 = 50;
int IN1 = 4;
int IN2 = 6;
int IN3 = 3;
int IN4 = 5;
void setup()
{
// Set the output pins
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
pinMode(enA, OUTPUT);
pinMode(enB, OUTPUT);
}
void loop()
{
analogWrite(enA, Speed1);
analogWrite(enB, Speed2);
// Rotate the Motor A clockwise
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
delay(1568);
// Motor A
digitalWrite(IN1, HIGH);
digitalWrite(IN2, HIGH);
delay(392);
// Rotate the Motor A counter clockwise
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
delay(1568);
// Motor A
digitalWrite(IN1, HIGH);
digitalWrite(IN2, HIGH);
delay(392);
// Rotate the Motor B clockwise
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
delay(1568);
// Motor A
digitalWrite(IN3, HIGH);
digitalWrite(IN4, HIGH);
delay(392);
// Rotate the Motor B counter clockwise
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
delay(1568);
// Motor A
digitalWrite(IN3, HIGH);
digitalWrite(IN4, HIGH);
delay(392);
(there is more it's just not relevant)