Question

Without doing anything - servo keep squeaking
Is this normal? do i need to set the servo pin as OUTPUT

  pinMode(servoPin ,OUTPUT);


Or attach is sufficient?

  myServo.attach(servoPin);

.

#include <Servo.h>
#define servoPin 9
Servo myServo;

void setup(){
   Serial.begin(38400);

  //pinMode(servoPin ,OUTPUT);
    myServo.attach(servoPin);
}
Was it helpful?

Solution

I don't know the innards of the Arduino servo lib code but I assume it begins functioning immediately after calling attach. What this means is that it is sending Pulse Width Modulation commands (see explanation at Servo City to the servo continuously - it is not simply on, move to position, then off, but rather the servo is being told constantly to maintain the set position.

You may have a cheap servo and hence the squeaking. I have some cheap ones I picked up which overshoot and then correct their position. The better (and more expensive) servos have much tighter gears and better electronics.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top