A potentiometer is an adjustable resistor with a slider or rotating shaft that acts as a voltage divider.

While potentiometers are available in a wide variety of packages and sizes, the easiest to use are those with built-in knobs or shafts capable of accepting knobs, like these below:

Potentiometer photos

You should generally use linear (rather than logarithmic) potentiometers with values between 10kΩ and 100kΩ (kΩ is pronounced ‘kilo Ohm’) with your Arduino/Genuino Uno.

Potentiometers can be connected to any of the analogue pins on your Arduino/Genuino Uno or Mega, labelled A0-A5 on the Uno and A0-A15 on the Mega, as shown in this example:

Potentiometer circuit diagram

As the shaft is turned, the voltage at the wiper terminal (which is usually the centre of the three terminals) will vary smoothly between ground (a voltage of 0V) and 5V.

Once your potentiometer is connected to your Arduino/Genuino Uno or Mega, use the Connect command to give it a name and tell MECControl which pin it is connected to:

Connect Hoist Potentiometer To Pin A5

In this example, a Potentiometer named Hoist has been connected to the analogue pin labelled A5. You can then refer to the potentiometer by name in later commands.

The Position property of a potentiometer ranges from 0 percent when the wiper voltage is 0V, to 100 percent when the wiper voltage is 5V. You can access it from any Jump, Let or Wait command, as in this example:

Wait For Hoist Position > 80 Percent

When this Wait command is played, sequence playback will be paused until the Position of the Hoist potentiometer is greater than 80 percent.