Serial Controlled Servo Sweep Issue

Hey all,

First post! I am working on a basic robot controlled by serial sent to is via a processing program. I am having issues getting the servo claw to work properly. I am using a Hi-Tech 422 Servo with a Lynxmotion gripper attachment powered by 9V battery.

The servo will turn one way to close, but will not turn the other way to open. I have tried all I can think of to debug the problem, but cannot come up with a solution.

Processing Code:

Arduino Code:

Let me know if anyone can find out the issue.

I am using a Hi-Tech 422 Servo with a Lynxmotion gripper attachment powered by 9V battery.

Well, supplying a 4.8v-6v servo with 9v may destroy it or make it operate erratically. Servo test code below.

// 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() {
  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 =;  //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.print("writing Angle: ");

    readString=""; //empty for next input