[SOLVED] ESP32-S2 Saola how turn on built-in RGB LED

filo_gr
Posts: 109
Joined: Wed Jul 28, 2021 12:25 pm
Location: Italy

[SOLVED] ESP32-S2 Saola how turn on built-in RGB LED

Postby filo_gr » Mon Aug 02, 2021 1:45 pm

Hello to everyone!

Today I turned on a ESP32-S2 for the first time. First thing I've seen was the RGB LED that was changing color (red, blue and then green).
Now I'd like to use it.
The problem: it uses pin GPIO18. Only one pin. Indeed I discovered it is an addressable RGB LED (WS2812) and it uses a particular protocol.
I didn't find anything to drive this LED. There is this website of Espressif https://docs.espressif.com/projects/esp ... /ledc.html but it doesn't help me because I need an example to know how to configure the various functions.
On the other hand I've seen some official examples, but I don't know if they cover this case.

Anyone has been able to make the RGB LED work?
Last edited by filo_gr on Tue Sep 21, 2021 7:23 am, edited 1 time in total.
Filippo

felmue
Posts: 69
Joined: Mon Nov 16, 2020 2:55 pm

Re: ESP32-S2 Saola how turn on built-in RGB LED

Postby felmue » Mon Aug 02, 2021 2:29 pm

Hello @filo_gr

have a look at the blink example. It also covers the RGB LED on the ESP32-S2 Saola board.

https://github.com/espressif/esp-idf/tr ... rted/blink

Thanks
Felix

filo_gr
Posts: 109
Joined: Wed Jul 28, 2021 12:25 pm
Location: Italy

Re: ESP32-S2 Saola how turn on built-in RGB LED

Postby filo_gr » Mon Aug 02, 2021 3:25 pm

Hi, thank you for you quick answer.
I tried the example but I obtain an error when build the project.
There is the #include "led_strip.h" that gives me an error (no such file or directory).
In fact I don't have this library! I searched for it inside my esp-idf folder. I found it however the functions in the example (such as led_strip_init) aren't declared in this header file!
I'm struggling to find a solution. :cry:
Filippo

felmue
Posts: 69
Joined: Mon Nov 16, 2020 2:55 pm

Re: ESP32-S2 Saola how turn on built-in RGB LED

Postby felmue » Mon Aug 02, 2021 8:23 pm

Hello @filo_gr

this particular include file is here: https://github.com/espressif/esp-idf/tr ... ip/include

Thanks
Felix

filo_gr
Posts: 109
Joined: Wed Jul 28, 2021 12:25 pm
Location: Italy

Re: ESP32-S2 Saola how turn on built-in RGB LED

Postby filo_gr » Tue Aug 03, 2021 2:11 pm

Dear @felmue,

Thanks a lot.
Unfortunately my issue is born from the fact I use VS Code, I'm not an expert user and I wasn't able to include the led_strip.h correctly (I'm still struggling to understand how to set .json)...
However I put all the code of led_strip_rmt_ws2812.c inside the blink code.. and now it works! :idea:
Beyond this fact, I ask another thing: I noticed on this page https://esp-idf-lib.readthedocs.io/en/l ... strip.html that this library may cause problems to WiFi.
:?: Anyone has experienced problems? What kind of solution is available? :?:
Filippo

filo_gr
Posts: 109
Joined: Wed Jul 28, 2021 12:25 pm
Location: Italy

Re: ESP32-S2 Saola how turn on built-in RGB LED

Postby filo_gr » Tue Sep 21, 2021 7:23 am

For anyone who experienced the same problem including a library with Visual Studio Code:

I put the line "compileCommands": "${workspaceFolder}/build/compile_commands.json" in the file c_cpp_properties.json
Then the path to the library in the following way (inside the CMakeLists.txt):
idf_component_register(SRCS "name of project.c" "#path to library/led_strip/include/led_strip.c" INCLUDE_DIRS ".")
Finally I can include the library in my code, inserting the path to the header file:
#include "#path to library/led_strip/include/led_strip.h"
After that I full compile the project, but before doing this I delete the build folder if errors occur.

Now I write that the problem is solved, however the following question remains open:
In the following page https://esp-idf-lib.readthedocs.io/en/l ... strip.html it says that
If you try to use this driver simultaneously with Wi-Fi, you may encounter RMT transmission bugs. To avoid them, simply initialize device from the task bound to the second processor core.
What does it mean exactly?
Filippo

Who is online

Users browsing this forum: No registered users and 115 guests