How to modify "sweep" code for straight line drive

My overall goal is to use an arduino uno to control a servo to rotate continuously in order to drive my robot in a straight line. First of all, when I use the regular, unedited Sweep code with my servo, it rotates one nearly full rotation, stops, then rotates again in the same direction. It should be rotating back and forth, not in one direction. However, I only need to go in one direction anyways, so I don't necessarily care to know how to fix this.

My main problem is the motor stopping. I tried taking the delay out, or setting it to 0, and it still did not rotate continuously. How can I modify this code, or is there any other code out there that I could use to make my servo rotate continuously without stopping?

The "servo" I'm using is actually a Vex 2 wire motor with a 3 wire motor controller 29. The motor controller 29 is supposed to make it able to be programmed as if it were a servo. It's actually a dc gear motor. This motor is made specifically to drive robots, so I assume I shouldn't have to take any sort of mechanical stop out of it like I've seen in some continuous drive servo guides.

My overall goal is to use an arduino uno to control a servo to rotate continuously in order to drive my robot in a straight line.

This requires modified servos. What kind do you have?

First of all, when I use the regular, unedited Sweep code with my servo, it rotates one nearly full rotation, stops, then rotates again in the same direction.

Why are you running code for regular servos with your modified servos?

My main problem is the motor stopping. I tried taking the delay out, or setting it to 0, and it still did not rotate continuously.

So, don't tell it to stop. Continuous rotation servos (which really aren't servos) are driven using the writeMicroseconds() method, not the write() method. The values range from somewhere around 600 for maximum speed in one direction to around 2400 for maximum speed in the other direction. In between, the values result in slower speeds, until some value (or small range of values) causes the "servo" to stop. You'll need to experiment to find the values that represent max speed each way and stopped.

The "servo" I'm using is actually a Vex 2 wire motor with a 3 wire motor controller 29. The motor controller 29 is supposed to make it able to be programmed as if it were a servo.

Isn't there any documentation you can refer to (or link to so we can read)?

Servo test code that might be of use.

// zoomkat 10-22-11 serial servo test
// type servo position 0 to 180 in serial monitor
// or for writeMicroseconds, use a value like 1500
// for IDE 0022 and later
// Powering a servo from the arduino usually *DOES NOT WORK*.

String readString;
#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 

void setup() {
  Serial.begin(9600);
  myservo.writeMicroseconds(1500); //set initial servo position if desired
  myservo.attach(7);  //the pin for the servo control 
  Serial.println("servo-test-22-dual-input"); // so I can keep track of what is loaded
}

void loop() {
  while (Serial.available()) {
    char c = Serial.read();  //gets one byte from serial buffer
    readString += c; //makes the string readString
    delay(2);  //slow looping to allow buffer to fill with next character
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string 
    int n = readString.toInt();  //convert readString into a number

    // auto select appropriate value, copied from someone elses code.
    if(n >= 500)
    {
      Serial.print("writing Microseconds: ");
      Serial.println(n);
      myservo.writeMicroseconds(n);
    }
    else
    {   
      Serial.print("writing Angle: ");
      Serial.println(n);
      myservo.write(n);
    }

    readString=""; //empty for next input
  } 
}