Hello all!
I am trying to build a robot arm using 5 servos. My idea to control this robot arm is to create a scale model of the robot arm with wood. The user would then manipulate that model of a robot arm, and the actual robot arm would mimic its movements. In order to do this, I want to put potentiometers at the joints of the scale model to measure the angles in between each part of the arm. The values of the potentiometers would then be scaled to match the range of the servos, and then those values would be written to the servos, thus creating mimicked moment.
To test this, I have connected only one potentiometer to my arduino board. I am using the Lynxmotion Botboarduino to control my robot arm. I have my code listed below, its fairly simple. All I was trying to do is connect the potentiometer to the board at the analog pin 3 (this is within the set of analog pins where the leftmost pin of each set of three is TX, the middle is RX, and the rightmost is Gnd) and then use the serial monitor to measure the input. However, when I connect the potentiometer to analog pin 3 and begin turning the knob left and right, there is no change in value within the serial monitor; it just stays at zero. I know that the potentiometer is affecting that pin though because when I remove the potentiometer, the value for that pin begins to oscillate around 250 (sometimes anywhere between 100 and 400). This potentiometer has a range of 0 - 1023, and it works when I test it with my Arduino Micro.
How do you think I can solve this?
[code]int potPin = A3; // select the input pin for the potentiometer
int value = 0; // variable to store the value coming from the sensor
void setup() {
// initialize serial
Serial.begin(9600);
}
void loop() {
value = analogRead(potPin);
Serial.print(value);
Serial.println();
}[/code]