Servo and joystick span difference

Hello everyone,
I have recently bought 2 of the maestro 12 servo controllers. My project is to build a custom rc tx and rx. I am using 1 Arduino Uno, 2 xbee 1, and 1 maestro, and a joystick from a discarded rc transmitter with a 5k ohm pot.
The pot is hooked to the Arduino and processed and output to the xbee. on the rx end I have the maestro connected to the xbee for the receiver, all works well except for 1 part I don’t understand. Now, the problem I am having is when I move the joystick say half way of travel the servo moves full travel. My question is , is there a way to sync or change the amount of travel of the servo to match the joystick? I am quite new to micro controllers. I have found that the maestro simplifies my project greatly.

Here is my code for 1 servo.test code.txt (1.84 KB)


void loop()
  val0 = analogRead(potpin1);// reads value of potentiometer (value between 0 and 1023)
  val0 = map(val0, 0, 1023, 350, 940) ; //scale it to use with the servo (value between 0 and 180)
  moveServo(0, val0); //Sets the servo position according to the scale value


It looks like the result of the re-mapping done in the main loop gives a value outside the range of what moveServo() expects. The moveServo() function defined in your code expects a target value between 0 and 180. I suggest changing the toLow and toHigh values in the map() function from 350 and 940 to 0 and 180.

- Jeremy

Thanks Jeremy,
I will give it a try and see what happens as soon as i get home. I will keep you posted.

Thanks again Jeremy,
It worked! I don’t know how I overlooked that, I guess I needed to take a break from it. This is why we have forums with great people on it. And it must be nice to be young and have a brain that works good as I am 60 years of age and always was fascinated with electronics.

Thanks for letting us know. I am glad it worked! Your project sounds interesting; I would love to hear more about it.

- Jeremy