motor code error

Once again, you need to read previous post thart contain info on ESCs and how they are armed.

https://www.google.com/search?hl=en&as_q=esc+arm&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=http%3A%2F%2Farduino.cc%2Fforum&as_occt=any&safe=images&tbs=&as_filetype=&as_rights=

well AWOL, I did not know that.

Which? That a ban beckons, or that your code loops?

Please, take some time to read replies to your questions before deleting them.

the code loops

Why did you think it was in a construct called "loop"?

FYI For zoomkat, I did already go to that before when it was sent to me before. The code did not work on the first website. I tried it again now and still nothing happened.

Also AWOL, I do sort of understand the loop thing. Its name is also self explanatory. Please help me with this code soon. I'm running out of time

Below is servo test code which you should be able to use to arm your ESC using the serial monitor. Apparently your ESC has beep codes indicating what it is doing. If you don't know the arming sequence, you should contact Parallax for the information.

// 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
  } 
}

probably the best help received so far. THANK YOU. Finally some descent help. When I type in anything between 0-180, it said writing angle: (number i typed in). The ESC was beeping the whole tome until I wrote 1500 then it stopped beeping and when I redid everything, it beeped only 2 or 3 times instead of continuous beeping. During the whole thing, the motor itself never moved.
here is the tutorial that I was trying to use but continuously failed before:

Doing some searching, you should be able to do the below with the code I posted. This assumes you have proper wiring and power for the motor/ESC.

"For my ESCs I have to output a pulse of 1000 (uS) for a few seconds until it beeps, then I can ramp it up to maximum speed at around 1800."

Im hooking it up to a 9 volts this whole time. My esc sitll only beeps when I hook it up to the 9 volt. I tried what you gave me again and it still does not work. Any suggestions?
do I need to program or setup my ESC some special way other than coping and pasting motor or servo codes. I just cant get it to work. The wires are connected the right way (I know this) I need help soon

I know it is a bit late in the game, but do you have the grounds connected?

yes

i learned much of the basics now. Now I need to know How to send PWM through port 9 (because it supports PWM).
I found out that my if off when it is at 1500 and at full speed when it is at 2500. Do I need to use analogWrite or somehow be able to use the serial monitor or something else?
How do I set PWM?

As far as the Servo library is concerned, all pins support PWM.
Don't think about using analogWrite with a servo or ESC.

what do I have to do then ?

I have no idea.
What are you trying to do?
What does your code look like?
What does it do that you don't want it to, and what doesn't do that you do want it to?

I need the PWM TO BE 2500
zoomkat gave me the code below. It does not do anything but was the best help I've had so far. he said that I put the values for angle milliseconds, etc in the serial monitor but when I do, nothing happens just my esc's beeps change each time i type in a number

// 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
}
}

ALL i NEED TO DO IS TO GET THE MOTOR TO SPIN
(i FORGOT TO MENTION THAT IN MY LAST POST)

It does not do anything

What do you mean by that?
You are entering numbers in the serial monitor, aren't you?

( when posting code, please use code tags, and please don't SHOUT)

This

 if(n >= 500)
    {
      Serial.print("writing Microseconds: ");
      Serial.println(n);
      myservo.writeMicroseconds(n);
    }
    else
    {   
      Serial.print("writing Angle: ");
      Serial.println(n);
      myservo.write(n);
    }

isn't really necessary; the Servo library does it for you - any value sent to the Servo write method greater than about 540 is automatically sent to the writeMicroseconds method.

lIm entering numbers like 1500 and 180,etc.
Nohthing happens except the ESC beeps. The motor does not spin.
It is giving really akward beeps now.
The capitals are accidental and I only realize it when it is too late
sorry for the long wait

The link you posted to the ESC said that it was controlled by PWM. The servo library produces PPM (pulse position modulation). You need to find out more about what signals your ESC is expecting.