On this example there is no information on how to connect the potentiometer to the circuit. It says the potentiometer is connected to the analog 0 of the Arduino. The pot has three legs. How do i conect it?
I am building a circuit to controll two steppers with a joystick. Two axes ( vertical and horizontal).
How should i modify this code:
* A stepper motor follows the turns of a potentiometer
* (or other sensor) on analog input 0.
* This example code is in the public domain.
// change this to the number of steps on your motor
#define STEPS 100
// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 8, 9, 10, 11);
// the previous reading from the analog input
int previous = 0;
// set the speed of the motor to 30 RPMs
// get the sensor value
int val = analogRead(0);
// move a number of steps equal to the change in the
// sensor reading
stepper.step(val - previous);
// remember the previous value of the sensor
previous = val;
to control my two steppers?
Thanks so much.