Need some guidance, working on a four-wheeled robot

I’m working on a four-wheeled robot and have the code in several parts, the part that I’m currently stuck on is a simple piece that runs all the wheels continuously, stops and turns. What I want is the wheels to run for some amount of time then stop, and rotate, then go straight again. This is what I have so far but it doesn’t work:

const int inAPin = 6;
const int inBPin = 8;
const int PWMPin = 7;
const int inCPin = 2;
const int inDPin = 4;
const int PWMPin2 = 3;
const int inEPin = A0;
const int inFPin = A1;
const int PWMPin3 = 5;
const int inGPin = A3;
const int inHPin = A2;
const int PWMPin4 = 9;

void setup() {

  pinMode(inAPin, OUTPUT);
  pinMode(inBPin, OUTPUT);
  pinMode(inCPin, OUTPUT);
  pinMode(inDPin, OUTPUT);
  pinMode(inEPin, OUTPUT);
  pinMode(inFPin, OUTPUT);
  pinMode(inGPin, OUTPUT);
  pinMode(inHPin, OUTPUT);
  pinMode(PWMPin, OUTPUT);
  pinMode(PWMPin2, OUTPUT);
  pinMode(PWMPin3, OUTPUT);
  pinMode(PWMPin4, OUTPUT);
}

void loop() {
  int i;

  delay(200);
  digitalWrite(inAPin, HIGH); //
  digitalWrite(inBPin, LOW);
  digitalWrite(inCPin, LOW); //
  digitalWrite(inDPin, HIGH);
  digitalWrite(inEPin, LOW); //
  digitalWrite(inFPin, HIGH);
  digitalWrite(inGPin, LOW); // 
  digitalWrite(inHPin, HIGH);

  for (i = 0; i < 175; i++){ 
     analogWrite(PWMPin, i);
     analogWrite(PWMPin2, i);
     analogWrite(PWMPin3, i);
     analogWrite(PWMPin4, i);
 }
 delay(2000);

  digitalWrite(inEPin, HIGH); // Wheel 3
  digitalWrite(inFPin, LOW);
  digitalWrite(inCPin, HIGH); // Wheel 1
  digitalWrite(inDPin, LOW);
  digitalWrite(inAPin, HIGH); // Wheel 2
  digitalWrite(inBPin, LOW);
  digitalWrite(inGPin, LOW); // Wheel 4
  digitalWrite(inHPin, HIGH);

  for (i = 0; i < 175; i++){ 
     analogWrite(PWMPin, i);
     analogWrite(PWMPin2, i);
     analogWrite(PWMPin3, i);
     analogWrite(PWMPin4, i);
 }
}

You used code tags on your first post. YAY! Karma++

You do describe what you want, and you posted your code. You should post what your code actually does, and how that differs from what you expect.

You also might read up about using arrays.

Thanks! I actually just updated my post and I will certainly look into arrays now.

Could you provide a bit more detail about what the code currently than just "it doesn't work"?

And how about what motor driver(s) you are using and perhaps even a circuit diagram showing what things like InAPin, PWMPin3 are connected to and are supposed to do and how everything is powered?

Steve

Cold_springs_coder: Thanks! I actually just updated my post and I will certainly look into arrays now.

I don't know what change you made but please don't make any substantial content changes to older Posts. Correcting typos is OK. Otherwise just post new material in a new Reply so that the Thread makes sense when read from top to bottom.

...R