randaza1:
Zoomcat....wow..I wish I would have seen that earlier...question, this is just showing the uno and 1 servo, I would be able to jump the uno board to the bread board to have more room for the other 3 servos right?
T
I can't speak to your breadboard setup, but the wiring looks simple. You need to connect a multimeter or similar to the SEL and to the ground and 5v to see how it connects to each when the switch is both open and closed. The SEL probably could connect to an arduino digital pin that is set high. When the switch is pushed it connects to the common ground pulling the arduino pin low. A multimeter will help you sort out the pots and the switch. Below is some servo pot code and bottom is servo switch code showing a simple arduino switch setup.
//zoomkat multi pot/servo test 3-23-13
//includes dead band for testing and limit servo hunting
//view output using the serial monitor
#include <Servo.h>
Servo myservo1; //declare servos
Servo myservo2;
Servo myservo3;
Servo myservo4;
Servo myservo5;
int potpin1 = 0; //analog input pin A0
int potpin2 = 1;
int potpin3 = 2;
int potpin4 = 3;
int potpin5 = 4;
int newval1, oldval1; //pot input values
int newval2, oldval2;
int newval3, oldval3;
int newval4, oldval4;
int newval5, oldval5;
void setup()
{
Serial.begin(9600);
myservo1.attach(2);
myservo2.attach(3);
myservo2.attach(4);
myservo2.attach(5);
myservo2.attach(6);
Serial.println("testing multi pot servo");
}
void loop()
{
newval1 = analogRead(potpin1);
newval1 = map(newval1, 0, 1023, 0, 179);
if (newval1 < (oldval1-2) || newval1 > (oldval1+2)){ //dead band
myservo1.write(newval1); //position the servo
Serial.print("1- ");
Serial.println(newval1); //print the new value for testing
oldval1=newval1; //set the current old value
}
newval2 = analogRead(potpin2);
newval2 = map(newval2, 0, 1023, 0, 179);
if (newval2 < (oldval2-2) || newval2 > (oldval2+2)){
myservo2.write(newval2);
Serial.print("2- ");
Serial.println(newval2);
oldval2=newval2;
}
newval3 = analogRead(potpin3);
newval3 = map(newval3, 0, 1023, 0, 179);
if (newval1 < (oldval1-2) || newval3 > (oldval3+2)){
myservo1.write(newval3);
Serial.print("3- ");
Serial.println(newval3);
oldval3=newval3;
}
newval4 = analogRead(potpin4);
newval4 = map(newval4, 0, 1023, 0, 179);
if (newval1 < (oldval1-2) || newval4 > (oldval4+2)){
myservo1.write(newval4);
Serial.print("4- ");
Serial.println(newval4);
oldval4=newval4;
}
newval5 = analogRead(potpin5);
newval5 = map(newval5, 0, 1023, 0, 179);
if (newval1 < (oldval1-2) || newval5 > (oldval5+2)){
myservo1.write(newval5);
Serial.print("5- ");
Serial.println(newval5);
oldval5=newval5;
}
delay(50); //to slow loop for testing
}
//zoomkat servo button test 12-29-2011
#include <Servo.h>
int button1 = 4; //button pin, connect to ground to move servo
int press1 = 0;
int button2 = 5; //button pin, connect to ground to move servo
int press2 = 0;
Servo servo1;
void setup()
{
pinMode(button1, INPUT);
pinMode(button2, INPUT);
servo1.attach(7);
digitalWrite(4, HIGH); //enable pullups to make pin high
digitalWrite(5, HIGH); //enable pullups to make pin high
}
void loop()
{
press1 = digitalRead(button1);
if (press1 == LOW)
{
servo1.write(170);
}
press2 = digitalRead(button2);
if (press2 == LOW)
{
servo1.write(10);
}
}