This is how we were able to make a robot with a fix axle move around in a 2x2 square and also shows how we set it up.
Step 1: The Items You Will Need
A 9v battery
A 9v battery connector
0.0 Philips head screw driver
4 DC motors
Adafruit Motor Shield
Arduino (we will be using Duemilavove/Diecimila)
Step 2: Getting the Arduino Ready
First you want to take your AdaFruit Motor Shield and put it onto you arduino. Then take you 9v battery connector and connect it to the battery supply port on you AdaFruit Motor Shield.
Step 3: Connecting the DC Motors to AdaFruit Motor Shield
Next take your four DC motors and connect them to the motor ports on the adafruit shield. If you have a robot like ours have the wires go to a logical position, we suggest that the two front motors connect to one side and the two back connect to the other. Example our front motors connect to motor 1 and 2 and the back motors connect to 3 and 4. No wires should be going into the motors GND ports these should be empty.
Step 4: Task
Our task for our robot was to move the robot in a 2 x 2 square.This is a challenge because this robot has a fixed axle it can only go forward and back so in the coding we have to use that to be able to turn the robot.
Step 5: The Code
This is the code that we have created to make the robot be able to move around and be able to turn to a different direction. It is set up with the same keys as a FPS, W for forward, S for backward, D to move right and L to move left. It communicates to the arduino by USB and using the serial monitor on arduino.cc software. Here is an example of our code. The robot will turn the direction the side the wheels are off so if the wheels are off on the right but are on on the left the robot will pivot and go right.