Pages: [1]   Go Down
Author Topic: servo problem (es 08a)  (Read 822 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Im using Es08A servo

i connect red to 5v, yellow to 9 and back to gnd

and using power source from cable


#include <Servo.h>
 
Servo myservo;  // create servo object to control a servo

void setup()
{
  myservo.attach(9,600,2400);  // attaches the servo on pin 9 to the servo object
}
 
void loop()
{
 
  myservo.write(15);                  // sets the servo position according to the scaled value
  delay(2000);
  myservo.write(0); 
 
  // waits for the servo to get there
}


Im using this code and seveal other codes but the rsult is same

the servo is only moving for 0.0001 second the moment i disconnect and reconnect it to 5v

but it does not move fully

the problem i think is

1.  the cable does not provide 5v power correctly
2.  servo is dead( its new though)
3.  I should use different value of code for this servo

if anyone know the ploblem let me know
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It isn't clear how you are powering the servo, are you using the Arduino power or seperate power ?

If you are using Arduino power, check the two links in my signature, then try seperate power.

Duane B

rcarduino.blogspot.com
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

im using computer power

not using any extra power source

Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
im using computer power

not using any extra power source
How much amperage is the computer able to supply your servo, via the Arduino? How much current does your servo draw. I'm betting that the answer to the latter question is greater than the answer to the former question.
Logged

Poole, Dorset, UK
Offline Offline
Edison Member
*
Karma: 50
Posts: 2207
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The code you posted moves the servo to 15 degree and keeps it there. The second time the program is run the servo is already at 15 degree so no movement.

The attempt to move the servo to the 0 degree position is ignored as you immediately (without any delay) tell it to move to the 15 degree position.

Mark
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Simple servo test code you can try.

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

Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Pages: [1]   Go Up
Jump to: