JoCircuit Logo

JoCircuit Hub

Arduino Control with Potentiometer

Learn how to read analog input from a potentiometer and control an output (e.g., LED brightness).

Step 1: Gather Components

Potentiometer Control Components

Step 2: Wiring the Circuit

Connect the potentiometer and LED to the Arduino:

Wiring Diagram for Potentiometer Control

Step 3: Arduino Code

// Placeholder for Potentiometer Control Arduino Code const int potPin = A0; const int ledPin = 9; int potValue; int ledBrightness; void setup() { pinMode(ledPin, OUTPUT); Serial.begin(9600); } void loop() { potValue = analogRead(potPin); ledBrightness = map(potValue, 0, 1023, 0, 255); analogWrite(ledPin, ledBrightness); Serial.println(ledBrightness); delay(100); }

Step 4: Upload and Observe

Upload the code to the Arduino. Rotating the potentiometer should change the brightness of the LED.

Potentiometer Control Setup