Simultaneous possible?

UKHeliBob:
It won't compile anyway because the code posted comes to an abrupt end like this

  //Motor B brake

digitalWrite(13, LOW);  //Stops forward direction
 digitalWrite(8, HIGH);   //Engages the Brake
 analogWrite(11, 0);    //Stops the motor

I am in the middle of writing up some of the coding, I havent finished which is why it stops there.

UKHeliBob: The track we have to run on doesn't have a line for it to follow and get the outside balls.


I . . . I
I . I
I _ I
I .---.---I_I---.---. I
I I
I . I
I . . . I
I___________________I

Hard to show but each . is a golf ball. The only lines are a cross horizontal and vertical intersecting through the box in the middle. I didnt put in the vertical line but it is in the middle of the track where the four . are lined up vertical.

The one idea we had was to have two distance sensors on one side of the robot (front and back) that is closest to the outside wall of the track and if they are the same value the wheels spin the same speed. If one is greater than the other then the wheels spin different speeds to correct it then continue at the same speed when the distance is the same again.

Any input or opinion of that idea would be greatly appreciated.

Thanks for everyones help so far. I am very new to the arduino coding. The only background I have is a digital electronics class where we used the board of education. But then again we only had little time with the board doing some very basic programs.