The RGBESP library provides an easy-to-use interface for controlling RGB LEDs with ESP32 boards using the LEDC hardware. It supports setting colors using RGB values, hexadecimal color codes, and predefined HTML color names. Additionally, it allows dynamic brightness adjustment for the LEDs without changing the color.
- Set LED color using RGB values.
- Set LED color using hexadecimal color codes.
- Use predefined HTML color names for easy color selection.
- Dynamically adjust the brightness of the LEDs.
- Download the latest release of the
RGBESP
library from the GitHub repository. - In the Arduino IDE, navigate to
Sketch
>Include Library
>Add .ZIP Library...
- Select the downloaded
.zip
file of theRGBESP
library and clickOpen
to install. - After installation, the library is ready to use in your projects.
#include <RGBESP.h>
// Initialize RGBESP with the GPIO pins for R, G, B LEDs
RGBESP rgbLed(40, 41, 42);
- Using RGB Values
rgbLed.setColor(255, 0, 255); // Sets the LED color to purple
- Using Hexadecimal Color Codes
rgbLed.setColorHex(0xFF0000); // Sets the LED color to red
- Using Predefined HTML Color Names
rgbLed.setColorHex(Aqua); // Sets the LED color to aqua
rgbLed.setBrightness(128); // Adjusts the brightness to 50%
Refer to the example.ino
file in the examples directory for a comprehensive demonstration of using the RGBESP
library to set colors and adjust brightness.
Contributions to the RGBESP
library are welcome. Please feel free to submit pull requests or open issues to improve the library or add new features.
This project is licensed under the MIT License - see the LICENSE file for details.