Controlling a brushless motor ESC

OK so i am obviously new to arduino and have read so much the past few days i think i have muddied the waters and cant figure something out. i have a brushless motor powered by a 100A ESC and 12 volt power. I can make the motor run with some code i have found on this site, however i need to modify the code so that once the motor is at speed it stays there indefinitely. I thought replacing the ramp down portion of the code and the motor stop for 5 seconds with a simple "For Loop" set speed (80) would make this happen but it doesn't.

// this uses the Arduino servo library included with version 0012 

// caution, this code sweeps the motor up to maximum speed !
// make sure the motor is mounted securily before running.

#include <Servo.h> 

Servo myservo;

void arm(){
 // arm the speed controller, modify as necessary for your ESC  
 setSpeed(0); 
 delay(1000); //delay 1 second,  some speed controllers may need longer
}

void setSpeed(int speed){
 // speed is from 0 to 100 where 0 is off and 100 is maximum speed
 //the following maps speed values of 0-100 to angles from 0-180,
 // some speed controllers may need different values, see the ESC instructions
 int angle = map(speed, 0, 100, 0, 180);
 myservo.write(angle);    
}

void setup()
{
 myservo.attach(9);
 arm();  
}


void loop()
{
 int speed;

 // sweep up from 0 to to maximum speed in 20 seconds
 for(speed = 0; speed <= 80; speed += 5) {
   setSpeed(speed);
   delay(1000);
 }
 // sweep back down to 0 speed.
 for(speed = 80; speed > 0; speed -= 5) {
   setSpeed(speed);
   delay(1000);
 }
 setSpeed(0);  
 delay(5000); // stop the motor for 5 seconds
}

Post the code that you are having trouble with and describe what it does and how that what it does is different than what you want it to do. "It doesn't work" does not sufficiently describe the problem.

+1 for using code tags without being asked.

Get rid of all this

 // sweep back down to 0 speed.
 for(speed = 80; speed > 0; speed -= 5) {
   setSpeed(speed);
   delay(1000);
 }
 setSpeed(0);  
 delay(5000); // stop the motor for 5 seconds

and see what happens.

Even simpler, all you need to make the motor go at a specific speed and stay at until you issue another command is

myservo.write(sss);

where sss is a value from 0 to 180.

...R

this code

// this uses the Arduino servo library included with version 0012 

// caution, this code sweeps the motor up to maximum speed !
// make sure the motor is mounted securily before running.

#include <Servo.h> 

Servo myservo;

void arm(){
 // arm the speed controller, modify as necessary for your ESC  
 setSpeed(0); 
 delay(1000); //delay 1 second,  some speed controllers may need longer
}

void setSpeed(int speed){
 // speed is from 0 to 100 where 0 is off and 100 is maximum speed
 //the following maps speed values of 0-100 to angles from 0-180,
 // some speed controllers may need different values, see the ESC instructions
 int angle = map(speed, 0, 100, 0, 180);
 myservo.write(angle);    
}

void setup()
{
 myservo.attach(9);
 arm();  
}


void loop()
{
 int speed;

 // sweep up from 0 to to maximum speed in 20 seconds
 for(speed = 0; speed <= 70; speed += 5) {
   setSpeed(speed);
   delay(1000);
 }
 // sweep back down to 0 speed.
 for(speed = 70; speed > 0; speed -= 0) {
   setSpeed(speed);
   delay(1000);
 }
 }

works. i just changed the 5 increment to 0 in the ramp down command.

thanks for all the help and input guys, I wish I had the knowledge to write elegant code that would preform this simple task. I scoured the web trying to find and esc that did not need to "Arm". if some built one that you could just apply power to and have a brushless motor turn on and run, maybe with a pot on it that you could set the speed with so that when power was applied it just came on and run i think you could sell them to guys like me. my project is for a tunnel hulled boat, see when these boats move through the water a suction forms that fills the tunnel and allows you to lift the height of the outboard so that you can run in really shallow water while on plane. this however is not always needed. it is also very inefficient for travel and economy. so what some people do is "Ventilate the tunnel to break the suction pulling the water up filling the tunnel. then they add a valve to the vent so you can basically inflate or deflate the tunnel. well in order for this simple solution to work to need to create a lower pressure where the vent penetrates the hull at the mouth of the tunnel. This requires adding plates and other devices which prevent laminar flow of the tunnel which can cause cavitation which goes away when the vent is opened. but if you vent the tunnel with out the plates on the bottom creating the low pressure the tunnel doesn't deflate completely. so you have to force air through the vent. Enter a 70mm ducted fan, 100 amp esc with bec and arduino. Now when i flip a switch a Solenoid opens my electic valves, powers my esc which powers my arduino uno, the program starts and runs then the motor runs force feeding my tunnel enough air to deflate. giving me more speed economy and ride.

am obviously new to arduino

Why "obviously"?

You will not find an esc that does not require arming. It is there for reasons of safety. Imagine turning on an r/c aircraft with the transmitter accidently left set to max. throttle, very dangerous. It is quite easy as others have said to code so it arms and then runs full speed allbeit under special requirements and safety at startup is not an issue. Power esc first, then arm with a low throttle setting in setup say (1000) then in then loop , send a high speed signal (2000) or what ever you need in the loop as Robin says. Either that or look for an r/c signal input and set to that.