Need help understand the code - 4WD car

My first post, as you may know.

I have placed L293D on top of Arduino Uno and connected 4 dual shift gear motors. Power supply is 2 x 18650 cells.

I uploaded the below code, found online.

int Motor[9] ; // Array for all Motor Output pins, one more than required

void setup() {
  Motor[1] = 4; // Set output numbers for ports
  Motor[2] = 5;
  Motor[3] = 6;
  Motor[4] = 7;
  Motor[5] = 8;
  Motor[6] = 9; // Set up Port for LED on Head of Arm.
  Motor[7] = 10; // Forward / Reverse selection for ALL motors
  Motor[8] = 11; 
  // Switch connected to GND and A0, to locally turn off motors while testing.
//  pinMode(Motor[1], OUTPUT); // Open Port to operate Motor on Pincers Forward = In Reverse = Out
//  pinMode(Motor[2], OUTPUT); // Open Port to operate Motor Up= High  Reverse = Down
//  pinMode(Motor[3], OUTPUT); // Open Port to operate Motor Forward = Forward Reverse = Backward 
  pinMode(Motor[4], OUTPUT); // Open Port to operate Motor Wrist Forward = Up Reverse = Down
//  pinMode(Motor[5], OUTPUT); // Open Port to operate Motor base Rotate Forward = Right Reverse = Left
//  pinMode(Motor[6], OUTPUT); // Open Port to operate LED on head of Arm HIGH = ON LOW = OFF
//  pinMode(Motor[7], OUTPUT); // Open Port for Forward / Reverse selection for ALL motors 
// pinMode(7, OUTPUT);
//pinMode(7, OUTPUT);
}
void loop() {
}

}[/color]

Please can you help understand, as i don't have a clue
(1) what is Motor[9]
(2) how come pinMode(Motor[4], OUTPUT); alone is spinning wheels
(3) when i power on and off and repeat, I see different wheels spinning
once only 1 wheel, off and on, 2 front wheels, off and on diagonal wheels spinning, sometimes 3 wheels, and very rarely 4 wheels with 1 spinning in reverse.
please someone help me.
I want a simple program that can spin all wheels. There is no bluetooth, infrared sensors etc. just want to run the car forward.

That is terrible code.

Please forget you ever saw it.

Please remember to use code tags when posting code

Presumably that L293D is mounted on a motor shield of some kind. Which one specifically do you have?

L293D Motor Drive Shield Expansion Board - DK Electronics

please see attached.

If looking at the commented code is painful, please deleted all commented code, but care to explain

int Motor[9] ; // Array for all Motor Output pins, one more than required

void setup() {
  Motor[1] = 4; // Set output numbers for ports
  Motor[2] = 5;
  Motor[3] = 6;
  Motor[4] = 7;
  Motor[5] = 8;
  Motor[6] = 9; // Set up Port for LED on Head of Arm.
  Motor[7] = 10; // Forward / Reverse selection for ALL motors
...
 pinMode(Motor[4], OUTPUT);
}

How much power need to be supplied. How to send HIGH to M1 M3, M4. At the moment only M2 is working

I found some code and it works like a charm

The topic can be closed

Typically an H-Bridge motor controller will require two or three pins PER MOTOR. For each motor you either have one Direction pin and one Enable pin or you have two Control pins, with or without a third Enable pin.

I recommend you find a nice library to use with your motor control shield.

Note: The 'Enable' pins are an easy way to control motor speed by connecting them to a PWM (analogWrite()) output pin. See: analogWrite() - Arduino Reference to determine which pins =on your Arduino support analogWrite().

I found some code and it works like a charm

Charms don't work, or "work" 50% of the time at best.