I am trying to attach a servo on an Arduino (branded) Robot but not sure whhich pin to use for the bellow code. Most people seem to recommend to use pin 9 and 10 to control the servo for arduino Unos. However, I can't use Pin 9 because that is already used as the Slave Select pin for the LCD. I have tried attaching it to pins TKD0-TKD3 by calling them pins 19-22 in myservo.attach(). The code runs but the servo doesn't rotate and only gets hot and/or twitches.
Could the problem be something other than incorrect pin connection?
Thanks, -M
I have been referencing these for the Control board pin mapping: http://arduino.cc/en/Main/Robot) http://fabcirablog.weebly.com/blog/grappling-with-the-arduino-robot-control-board
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int pos = 0;
void setup()
{
myservo.attach(19); // attaches the servo on pin 9 to the servo object
}
void loop()
{
for(pos = 0; pos < 60; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 60; pos>=1; pos-=1)
{
myservo.write(pos);
delay(15);
}
}