0Pricing
Arduino & IoT Academy · Lesson

Knob Controls LED Brightness

Combine a pot reading with PWM output.

Let a Knob Do the Driving

Now you combine two skills: read a potentiometer and use that reading to set an LED's brightness in real time. 🎛️

The Knob Speaks 0 to 1023

analogRead gives you a 0 to 1023 value as you turn the pot. That is the position of the knob expressed as a number.

int knob = analogRead(A0);

All lessons in this course

  1. What PWM Actually Does
  2. analogWrite 0–255
  3. Fade an LED Up and Down
  4. Knob Controls LED Brightness
← Back to Arduino & IoT Academy