I have couple of 9g SG90 servos that i want to control using the argon. I chose Pins D7 and D8 for that. Everything seems to be working fine on pin D8. However, when i use the same code on D7 and connect the servo, it does not seem to work, it just jitters and stops.
Is there something different that needs to be done to get the servo work on D7? I am using standard code i found on the internet.
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(D7); // attaches the servo on the D0 pin to the servo object
// Only supported on pins that have PWM
}
void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
Any guidance is appreciated. Thanks!