Motor stop

Hi,

I use ATMega 2560. I use the default program sweep for servo. I want my servo to to 0 to 180 non stop in loop. So it works but only for 5 minutes and I want it like for ever. What's wrong please ? Thank you

// Sweep
// by BARRAGAN <http://barraganstudio.com> 
// This example code is in the public domain.


#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
int pos = 0;    // variable to store the servo position 
 
void setup() 
{ 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
} 
 
 
void loop() 
{ 
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(6);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(6);                       // waits 15ms for the servo to reach the position 
  } 
}

How is your servo wired? How is your servo powered? How is your Arduino powered?

There is nothing wrong with the code, so it must be a hardware problem.

Servo is wired with the servo wire (3pin female) directly on a ShieldV4 on my board. So the servo is powered with the board. The board is powered trought the usb port of my laptop.

Servo is wired with the servo wire (3pin female) directly on a ShieldV4 on my board.

No idea what a ShieldV4 is. A link would be useful.

So the servo is powered with the board. The board is powered trought the usb port of my laptop.

Servos can take a lot of current - more than a USB port can supply. The computer is protecting itself turning off power to the Arduino.

This is the shield V4 for arduino :

There is still led on when the servo stop. Does the laptop still send a little power ?

There is still led on when the servo stop. Does the laptop still send a little power ?

Which LED?

you should post the schematics or your circuit for anyone understand and can help you...
which servo are you using?