With this code running, you can use a screwdriver to adjust the internal potentiometer to let the motor stand still. Change the "1500" delay to another number to observe the directional control.
If anyone knows how to accomplish this using the Arduino libraries I would appreciate knowing.
Paul.
int servoPin = 10;
void setup()
{
pinMode(servoPin,OUTPUT);
}
void loop()
{
digitalWrite(servoPin,HIGH);
delayMicroseconds(1500); // 1.5ms
digitalWrite(servoPin,LOW);
delayMicroseconds(18500); // 18.5ms
}
UPDATED BY IVAN:
Try this code.
int servoPin = 9;
void setup()
{
pinMode(servoPin,OUTPUT);
}
void loop()
{
int temp;
for (temp = 0; temp <= 100; temp++)
{
digitalWrite(servoPin,HIGH);
delayMicroseconds(1500); // 1.5ms
digitalWrite(servoPin,LOW);
delay(20); // 20 ms
}
for (temp = 0; temp <= 30; temp++)
{
digitalWrite(servoPin,HIGH);
delayMicroseconds(1600); // 1.6ms
digitalWrite(servoPin,LOW);
delay(20); // 20ms
}
//delay(100);
for (temp = 0; temp <= 31; temp++)
{
digitalWrite(servoPin,HIGH);
delayMicroseconds(1400); // 1.4ms
digitalWrite(servoPin,LOW);
delay(20); // 20ms
}
}
I just found this out, but I've been playing and it's harder to control the angle.
ReplyDeleteIf we still have the receipts we might want to return half of the servos we bought and get regular ones.