Pin names
Ground
Output, connect to an analog input pin
Supply voltage
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.
Attributes
Initial value of the potentiometer, between 0 and 1023
Using the Potentiometer in Arduino
Connect the SIG pin to one of Arduino’s analog input pins (A0, A1, …). Then use theanalogRead() 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:
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
Automation controls
The potentiometer can be controlled using Automation Scenarios. It exposes the following controls:Moves the potentiometer to the given position, between 0.0 and 1.0
Simulator examples
- Knob - Control a servo with a potentiometer
- Plot - Plot potentiometer values in the Serial Plotter
- Block shooter - Breakout style game