Go Down

Topic: [Solved]Servomotor and 360° (Read 144 times) previous topic - next topic

NoServo

Apr 03, 2019, 07:52 pm Last Edit: Apr 03, 2019, 08:32 pm by NoServo
Hi!
I do believe after reading some docs over servomotors that a servomotor isn't supposed to go over 180°, however, mine turned for a while(in the same direction).
I used this code :

#include <Servo.h>
Servo monServomoteur1;
int position_ini;

void setup() {
  // put your setup code here, to run once:
  monServomoteur1.attach(7);
}

void loop() {
  position_ini=monServomoteur1.read();
  turn(178,monServomoteur1,position_ini);
}
void turn(int p1, Servo monServomoteur, int p2){
  if(p1<180){
    if(p1>monServomoteur.read()){
      int pos =p2;
      while(pos<p1){
        monServomoteur.write(pos);
        pos++;
        delay(15);
      }
    }
  }
}

Did I broke my servomotor or is there something I didn't understand about 0 to 180°.
Thanks

vinceherman

Hi NoServo, welcome to the forum.

Do you have a link to the servo you are using?

Standard servos work through a defined range, usually a bit less than 180 degrees, but it varies.
And many servos are modified, either by the end user or at the factory, to be continuous rotation or 360 degree servos.  These servos have no positional awareness and are really just nicely packaged DC motors with a driver and gearbox.

If you let us know what you have, we can help you with your understanding.

NoServo

Hi vinceherman and thank you for your quick answer.
I used this one:
https://store.arduino.cc/digital-continuous-rotation-360-servo

I guess it means I am just using a continuous rotation motor working with the library Servo.

pert

You got it. With a continuous rotation servo like you have, monServomoteur.write(pos) will control the direction and speed of the rotation, rather than the position as with a standard servo:
https://www.arduino.cc/en/Reference/ServoWrite
Quote
On a continuous rotation servo, this will set the speed of the servo (with 0 being full-speed in one direction, 180 being full speed in the other, and a value near 90 being no movement).

Go Up