Two continuous servo with one axis of joystick and vary speed

Hello'
I am new with arduino. I have arduino uno board and want run 2 continuous servo motor with one joystick (2 axis). But instead of using two axis of the joystick, I want want to use only one axis of the joystick to rotate 2 continuous servo motor which I apply to drive a car and gradually wanted to vary the speed of continuous motors.. Please help....
:frowning:

Hi,
So you want to use the joystick as a throttle.

Tom.... :slight_smile:

I want want to use only one axis of the joystick to rotate 2 continuous servo motor which I apply to drive a car and gradually wanted to vary the speed of continuous motors.

The below might be close to what you want. I don't have servos or pots to test now, so the below may/may not work.

//zoomkat 8-21-15 pot servo test
//opposite side servos rotate together

#include <Servo.h> 
Servo myservo1;  // create servo object to control a servo 
Servo myservo2;
int potpinS1 = 0;  //analog input pin A0
int newvalS1, oldvalS1;

void setup() {
  Serial.begin(9600);
  myservo1.attach(8);
  myservo2.attach(9);
  Serial.println("servo joystick test"); // so I can keep track of what is loaded
}

void loop() {
  newvalS1 = analogRead(potpinS1);           
  newvalS1 = map(newvalS1, 0, 1023, 70, 110); //servo operating band
  //add some dead band 
  if (newvalS1 < (oldvalS1-1) || newvalS1 > (oldvalS1+1)){
    //value sent to servos 
    Serial.println(newvalS1);
    myservo1.write(newvalS1);

    Serial.println(180-newvalS1);
    myservo2.write(180-newvalS1);

    Serial.println(); //seperate values in serial monitor
    oldvalS1=newvalS1;
  } 
  delay(50); //slow down looping to better read serial monitor 
}

Thanks for the programming #Zoomkat. But the programming is applicable for Normal servo motor. Can not run the continuous servo motor (parallax).. Please help. I'm attaching the data sheet of continuous servo motor.

900-00025-High-Speed-CR-Servo-Guide-v1.0.pdf (135 KB)

TomGeorge:
Hi,
So you want to use the joystick as a throttle.

Tom.... :slight_smile:

Yes TOM.. Can you help???