list of products from Amazon (Not mine, i just link them!) Scroll Down For Article! Note: Elegoo boards are not Arduino, but they are compatible with Arduino IDE and are mutch more affordable!
- Description: Control the color of an RGB LED using three potentiometers for red, green, and blue components.
- Requirements: RGB LED, 3 potentiometers, resistors.
- Learning Points: PWM (analogWrite), RGB color blending.
How It Works
Potentiometer Values:
- Each potentiometer adjusts a single color component (Red, Green, or Blue).
- The potentiometer’s position determines an analog value between 0 and 1023.
Mapping Values:
- The analog input values (0–1023) are mapped to the PWM range (0–255) using
map()
.
- The analog input values (0–1023) are mapped to the PWM range (0–255) using
PWM Output:
analogWrite()
is used to set the brightness of each color component.
Color Mixing:
- By combining different brightness levels of Red, Green, and Blue, you can create millions of colors.
0 Comments