Go Down

Topic: NEED SOME HELP WITH SERVO URGENT!!!! (Read 717 times) previous topic - next topic

nouh00

hi everyone,


i just modified a small servo,this servo didnt require that i add anything since it was fairly small so what i did was smoothen out the hole which connects to the potentiometer.then i put everything back and the servo was finally capable of turning 360 degrees but with the example code provided by arduino it makes the servo go one way for like 5 seconds,stop,go other way for like 1/10 of a second then go back the other and keeps doing that over and over again.since im not such a "badass" programmer i cant figure whats wrong so if someone can please give me a code that will work then that'll be awesome!

here's the link for the servo motor i got: https://www.sparkfun.com/products/9065
(btw i have the servo hooked up straight to arduino but just for now till i get everything running)

ANY HELP IS APPRCIATED!! 8)

retrolefty

I suspect nothing is wrong. You just have to learn how the servo library works and how the commands differ when your using a modified continuous rotation servo instead on using a standard unmodified servo.

Quote
since im not such a "badass" programmer i cant figure whats wrong so if someone can please give me a code that will work then that'll be awesome!


Well it sounds to me like you need to take some time first to learn how to program your arduino using it's C/C++ programming language. We have no idea what you want your servo to perform. So learn to be a "bad ass programmer" and It will open up a world of possible things to do with your arduino, and maybe even a nice career in your future.

Even PaulS wasn't born knowing how to program.  ;)

Lefty

nouh00


I suspect nothing is wrong. You just have to learn how the servo library works and how the commands differ when your using a modified continuous rotation servo instead on using a standard unmodified servo.

Quote
since im not such a "badass" programmer i cant figure whats wrong so if someone can please give me a code that will work then that'll be awesome!


Well it sounds to me like you need to take some time first to learn how to program your arduino using it's C/C++ programming language. We have no idea what you want your servo to perform. So learn to be a "bad ass programmer" and It will open up a world of possible things to do with your arduino, and maybe even a nice career in your future.

Even PaulS wasn't born knowing how to program.  ;)

Lefty


well im trying to have it move 360 degrees to the left the stop the n360 degrees to the right,can someone please help byposting a working code plzzzzz

zoomkat

Servo trest code you can try.

Code: [Select]

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

Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy