Go Down

Topic: Motor stop (Read 617 times) previous topic - next topic

Arduino001

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

Code: [Select]
// 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
  }
}

PaulS

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.

Arduino001

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.

PaulS

Quote
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.

Quote
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.

Arduino001

This is the shield V4 for arduino :

http://www.ebay.ca/itm/Arduino-UNO-MEGA-Duemilanove-Sensor-Shield-V4-Digital-Analog-Module-Servo-Motor-/181014763507?pt=LH_DefaultDomain_0&hash=item2a255217f3

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

PaulS

Quote
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?
For some Awesome Arduino Projects  click -> www.randomnerdtutorials.com

Go Up