How to alter the value of a signal via poti?

Hi.

poti1 should accelarate both motors simultaneously.

poti2 should alter the value given by poti1, so that when i turn the poti left the left motor gets the max value determined by poti1 and the right motor should get a decreasing value from the max value determined by poti1.

Does anyone know what i have to do in order to achieve this? I am sure this is kind of easy but I am pretty new to the Arduino stuff.

#include <Servo.h>
Servo ESC;     // create servo object to control the ESC
Servo ESC2;
int potValue;  // value from the analog pin
void setup() {
  // Attach the ESC on pin 9, ESC2 on pin 10
  ESC.attach(9,1000,2000); // (pin, min pulse width, max pulse width in microseconds) 
  ESC2.attach(10,1000,2000); // (pin, min pulse width, max pulse width in microseconds) 
}
void loop() {
  potValue = analogRead(A0);   // reads value of the potentiometer (value between 0 and 1023)
  potValue = map(potValue, 0, 1023, 0, 180);   // scale to set max speed (value between 0 and 180)
  ESC.write(potValue);    // Send the signal to the ESC
  ESC2.write(potValue);    // Send the signal to the ESC2
}

You need to read that second pot and do the math You told us.

Please follow the advice given in the link below when posting code , use code tags and post the code here to make it easier to read and copy for examination

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.