JavaSheriff
JavaSheriff

Reputation: 7675

Arduino - servo keep squeaking

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);
}

Upvotes: 0

Views: 149

Answers (1)

spring
spring

Reputation: 18497

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.

Upvotes: 2

Related Questions