Slide potentiometer to motor controllers

i recently purchased a Grove slide potentiometer, ran the example code to see what the min/max values are, used some code i cobbled together, and it doesn't work. Based off this code:

#include <Servo.h>

int throttle = A0; //throttle input pin
int adcIn = 0;
Servo JagTalon; //PWM line feeding Jag and Talon
Servo Talon; // Talon's PWM

void setup() { 
JagTalon.attach(9);
Talon.attach(10);
}

void loop() {
  adcIn = analogRead(throttle);
  JagTalon.writeMicroseconds(adcIn+1000-40);
  Talon.writeMicroseconds(adcIn+1000-40);
}

and that the min/max are 0/1023, can someone help me figure out why it wont work?? The speed controllers both use 1500 microseconds = neutral, 2000 microseconds = full forward

adcIn = analogRead(throttle);
If you Serial.print(adcIn); what range do you get?

Here's the range I got
Minimum: 0
Maximum: 1023

Have you tried something like this?

val = analogRead(throttle);
adcIn = map(val, 0, 1023, 0, 180);
JagTalon.write(adcIn); // Turn Servo to adcIn degrees
delay(1000);

I'll give that a shot in the morning and let you know the results

Alright codes working, just found one major flaw, at 0% throttle the motors run full reverse :stuck_out_tongue: and at the 1023 max value its 85% in reverse

If your "motors" are continuous rotation servos, you may need to "calibrate" them. Assuming you want forward and reverse motion, put the slide to mid position, then adjust the servo pot until the servo stops rotating.

No continuous rotation servos here. Using 2 Cross the Road Electronics Talons and one TI Jaguar speed controller. The signal these get from the slide needs some adjustment :stuck_out_tongue: suggestions??

suggestions??

Never heard of your gizmos. Got any info?

Both Talons and Jaguars operate on a PWM signal and are driven just like servos. For both controllers its the following
1000 microseconds = full reverse
1500 = neutral
2000 = full forward
I need my throttle to be sending 1500 when the value is 0 and be writing 2000 when the value is 1023

I need my throttle to be sending 1500 when the value is 0 and be writing 2000 when the value is 1023

Try this:

void loop() {
  adcIn = analogRead(throttle);
  adcIn = map(adcIn, 0, 1023, 1500, 2000);
  JagTalon.writeMicroseconds(adcIn);
  Talon.writeMicroseconds(adcIn);
}

Lefty