-
Notifications
You must be signed in to change notification settings - Fork 0
Dimmable Light
Vishwas Parpattegar edited this page Sep 3, 2025
·
1 revision
Create a dimmable LED light system using a potentiometer to control brightness.
- Use a potentiometer to read analog values (0-1023)
- Map analog readings to PWM values (0-255)
- Control LED brightness smoothly using PWM
- Display current brightness values on Serial Monitor
Potentiometer: 512, Brightness: 127
Potentiometer: 768, Brightness: 191
Potentiometer: 256, Brightness: 63
- Use
analogRead()
for potentiometer input - Use
analogWrite()
for PWM output to LED -
map()
function converts between value ranges - Connect potentiometer signal to analog pin (A0)
- Connect LED to PWM-capable pin (pin 3)
Add a toggle button that locks the current brightness level. When pressed, it prevents the potentiometer from adjusting brightness. Press again to unlock and resume normal operation.