I currently have a servo wired to my Arduino and have imported the Servo.h. Here is my sketch:
#include <Servo.h>
Servo s1;
Servo s2;
void setup()
{
Serial.begin(9600);
s1.attach(8);
s2.attach(9);
}
int pos = 0;
void loop()
{
pos = 0;
if(s1.read() != pos)
s1.write(pos);
if(s2.read() != pos)
s2.write(pos);
delay(1000);
}
The problem is that even when my servos are at the position 0 it still tries to turn and I hear it trying. What do I have to do to tell it to stop turning once it is already at the desired position?
So this is my second bit of code:
s1.write(0);
delay(5000);
s1.write(100);
delay(5000);
s1.write(180);
delay(5000);
When I write them to 100/180 (or any number) they are silent after the turn, but when I write them to 0 I hear them keep trying to turn...