Crooked Steering

I built a robot with tank treads and two toy motors. The arduino runs two relays which, in turn, drive the motors. Heres my code that I use with the robot;const int leftMotor = 10;
const int rightMotor = 5;

void setup() {
pinMode(rightMotor, OUTPUT);
pinMode(leftMotor, OUTPUT);
void loop()
digitalWrite(leftMotor, HIGH);
digitalWrite(rightMotor, HIGH);
digitalWrite(leftMotor, LOW);
digitalWrite(rightMotor, LOW);

Now for some reason it runs strait till it shuts the power off then one tread goes in for a little and slows down while the other stops immediately. I thought it was the alignment or the treads but deduced that its not. Can some one help me with trouble shooting and fixing my problem?

Thanks Riley

P.S. It also swerves to the left

Are the two relays wired the same way?

My guess would be more friction in one motor/gearbox/tread.

Sounds like you need to control the speed of the motors, and not simply turn
them on and off. Identical motors/parts always have slightly different
characteristics, and toy motors have low quality assurance to start with.

Look for motor shields for the Arduino - with toy motors, the ones that
use the low-current L293D chips should work ok. Even with speed control, it's
not always easy to get the robot to go perfectly straight, but it will help.