Skip to main content

wokwi-potentiometer Reference

Knob-controlled variable resistor (linear potentiometer)

The information below also applies to the slide potentiometer.

Pin names

SIGOutput, connect to an analog input pin
VCCSupply voltage

Note: Wokwi does not support full analog simulation, so you will get the same results even if you don't connect the GND/VCC pins.

This may change in the future, so it's a good idea to connect GND/VCC anyway.


NameDescriptionDefault value
valueInitial value of the potentiometer, between 0 and 1023"0"

Using the Potentiometer in Arduino

Connect the SIG pin to one of Arduino's analog input pins (A0, A1, …). Then use the analogRead() function to read the current value of the potentiometer.

The following code example assumes that the potentiometer is connected to A0. It will read and print the current value of the potentiometer every 100 milliseconds:

void setup() {
pinMode(A0, INPUT);

void loop() {
int value = analogRead(A0);

You can run the example on Wokwi. Observe how the plotter graph changes as you move the potentiometer's knob.

Keyboard control

You can control the potentiometer with the keyboard:

  • Left / Right - fine movement
  • Page Up / Page Down - coarse movement
  • Home / End - move to the start (0) or the end (1023) of the range

You'll need to click on the potentiometer before using these keyboard shortcuts.

Simulator examples

  • Knob - Control a servo with a potentiometer
  • Plot - Plot potentiometer values in the Serial Plotter
  • Block shooter - Breakout style game