EasyManuals Logo

Freenove ESP32 User Manual

Default Icon
159 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #107 background imageLoading...
Page #107 background image
Need support? support@freenove.com
105
Chapter 9 WS2812
www.freenove.com
117
118
119
120
121
122
123
124
125
break;
}
}
void task_RGBLeds(void *pvParameters) {
while (1) {
task_showRGBLeds(NULL);
}
}
Apply for a colored light control object and configure this object.
3
Freenove_ESP32_WS2812 strip = Freenove_ESP32_WS2812(LEDS_COUNT, LEDS_PIN, CHANNEL, TYPE_GRB);
Initialize the RGB LEDs, and set their brightness to the maximum value. Start a thread and set task_RGBLeds()
as the callback function of the thread.
19
20
21
22
23
void setupRGBLED() {
strip.begin();
strip.setBrightness(255);
xTaskCreateUniversal(task_RGBLeds, "task_RGBLeds", 4096, NULL, 1, NULL, 1);
}
RGB LEDs configuration function. Call this function to set the colored light mode and the red, green, and blue
color values of the LEDs.
25
26
27
28
29
30
void setRGBLED(uint8_t mode, uint8_t r, uint8_t g, uint8_t b) {
ledConfig_t.mode = mode;
ledConfig_t.r = r;
ledConfig_t.g = g;
ledConfig_t.b = b;
}
LED display function. The thread will control the RGB LEDs to emit different colors and phenomena according
to the configuration information of ledConfig_t.
32
33
34
42
43
51
52
59
60
77
78
void task_showRGBLeds(void *pvParameters) {
switch (ledConfig_t.mode) {
case LED_MODE_OFF:
……
break;
case LED_MODE_RGB:
……
break;
case LED_MODE_FOLLOWING:
……
break;
case LED_MODE_BLINK:
……
break;
case LED_MODE_BREATHING:
……

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Freenove ESP32 and is the answer not in the manual?

Freenove ESP32 Specifications

General IconGeneral
BrandFreenove
ModelESP32
CategoryComputer Hardware
LanguageEnglish

Related product manuals