Hello! I'm relatively new to Arduino and these forums, but have had great success with Adafruit's tutorials and use of the Wave Shield, Motor Shield (with stepper and DC motors, and 1 servo), and some other components (relays, LEDs, etc) .
I am now trying to control 2 servos separately on two individual potentiometers. I can run one servo on one pot, or run both servos on the same pot, but I cannot run both individually (in hopes of eventually creating a pan/tilt head, then attaching it to my parallax 27800 joystick).
I am using the Arduino Uno.
Here's what I see as the problem:
In a sketch, I can give the command for "myservo1.attach(9)" or "myservo2.attach(10)" without problems, but as soon as I add both, pins 9 and 10 connect to each other (I read about 40ohms resistance on my meter). They do this directly from the Arduino Uno, even with the motor shield removed.
I removed the motor shield and all components then attached my meter to pins 9 and 10, then went through the sketch and added one line of code at a time and waited for the meter to read a connection, and it was definitely at the inclusion of two attach commands.
When I use the example sketch "bare minimum" there is no connection.
However, when I use this next sketch, digital pins 9 and 10 read 43ohms of resistance between each other (connected!):
#include <Servo.h>
Servo myservo1; // create servo object to control a servo
Servo myservo2;
int potpin1 = 0; // analog pin used to connect the potentiometer
int potpin2 = 1;
int val; // variable to read the value from the analog pin
void setup()
{
myservo1.attach(9); // attaches the servo on pin 9 to the servo object
myservo2.attach(10);
}
void loop()
{
}
Since 9 and 10 are my signal pins, I think it will be impossible to make this work without help.
Ideally, this was the sketch I was planning to use:
#include <Servo.h>
Servo myservo1; // create servo object to control a servo
Servo myservo2;
int potpin1 = 0; // analog pin used to connect the potentiometer
int potpin2 = 1;
int val; // variable to read the value from the analog pin
void setup()
{
myservo1.attach(9); // attaches the servo on pin 9
myservo2.attach(10); // attaches the servo on pin 10
}
void loop()
{
val = analogRead(potpin1); // reads the value of the pot
val = map(val, 0, 1023, 0, 179); // scale it between 0 and 180
myservo1.write(val); // sets servo according to the scaled value
val = analogRead(potpin2); // reads the value of the pot
val = map(val, 0, 1023, 0, 179); // scale it between 0 and 180
myservo2.write(val); // sets servo according to the scaled value
delay(15); // waits for the servo to get there
}
... but this just makes my two servos move in sync, because the signal wires are connected (at least that's what I think)!
Thanks in advance for any help! I can provide screen shots if needed, but I've tried so many configurations, and I think I've identified the problem, I just can't find the solution!
Regards,
Jason