#115
In this project, we control the brightness of an LED analogically using a potentiometer. The ESP32's ADC pin reads the 0-3.3V voltage from the potentiometer, and this value is then converted into a PWM (Pulse Width Modulation) signal and sent to the LED. As a result, as you turn the potentiometer, the LED gradually brightens and dims. With Arduino Core 3.0+, `analogWrite()` can be used directly; on the ESP32-S2/S3, the ADC resolution is fixed at 12-bit.

Become Premium to view the source code
Unlock Everything with Premium
All project code, FAQ sections, and troubleshooting guides for Premium members. Buy in the mobile app.