Hi, I'm very new to programming and using Arduino, and I'm trying to send a servo to a specific position. I wrote the code that will do this, but my servo hums at almost any position other than 180 degrees. Why? For example, in my code I replace "180" with "45" and the servo hums but does travel to the correct spot. How do I stop applying a signal to the servo to save power and eliminate the hum? Thanks!
Here is my simple code:
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int pos = 180; // variable to store the servo position
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()
{
myservo.write(pos); // tell the servo to go to the position defined
delay(15); // wait for the servo to get there.
}