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 #104 background imageLoading...
Page #104 background image
Need support? support@freenove.com
102
Chapter 9 WS2812
www.freenove.com
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#define LED_MODE_OFF 0
#define LED_MODE_RGB 1
#define LED_MODE_FOLLOWING 2
#define LED_MODE_BLINK 3
#define LED_MODE_BREATHING 4
#define LED_MODE_RAINBOW 5
void setupRGBLED();
void setRGBLED(uint8_t mode, uint8_t r, uint8_t g, uint8_t b);
void task_showRGBLeds(void *pvParameters);
void task_RGBLeds(void *pvParameters);
#endif
RGBLED_WS2812.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "RGBLED_WS2812.h"
Freenove_ESP32_WS2812 strip = Freenove_ESP32_WS2812(LEDS_COUNT, LEDS_PIN, CHANNEL, TYPE_GRB);
struct LedConfig {
uint8_t mode;
uint8_t r;
uint8_t g;
uint8_t b;
} ledConfig_t;
int followingColorStep = 0;
int breathingStep = 2;
int rainbowStep = 2;
bool blinkStateUp = true;
bool breathingStateUp = true;
u32 lastStripUpdateTime = 0;
void setupRGBLED() {
strip.begin();
strip.setBrightness(255);
xTaskCreateUniversal(task_RGBLeds, "task_RGBLeds", 4096, NULL, 1, NULL, 1);
}
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;

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