A linear potentiometer works like a rotary one, but the knob slides along a track. It is a voltage divider you can adjust by hand: the middle pin (the wiper) gives a voltage between 0 V and the supply voltage, depending on the knob position. In the simulator you drag the knob while the simulation runs.
Wiring
| Pin | Connect to |
|---|---|
| End A | GND |
| Wiper W (output) | An analog input pin of the board |
| End B | VCC (the board's logic voltage, 3.3 V or 5 V) |
Do not connect the wiper to VCC or GND directly: it is the signal output.
Reading it
The analog pin reads a number that grows with the knob position (0 at the A end, the maximum at the B end). The Linear Potentiometer blocks read it for you:
- setup sets the analog pin once.
- read returns the position as a percentage (0 to 100) or the raw reading.
- map to range scales the position to your own range, for example 0 to 180 for a servo angle.
- voltage returns the voltage at the pin.
- is above and is between give true or false, for conditions such as "when the slider is past 70 %".
Properties
The track resistance sets how much current the divider draws; 10 kΩ is a good default. The position is the knob position and can be dragged on the canvas.
Troubleshooting
- The reading is stuck at 0 or the maximum: check that the two ends are on GND and VCC and the wiper is on an analog-capable pin.
- The reading jumps around: use a pin that is not shared with Wi-Fi on boards where some analog pins stop working while Wi-Fi is on.

