The example code for ESP32 for BlinkRGB.ino shows and example for
digitalWrite(RGB_BUILTIN, HIGH); // Turn the RGB LED white
This code does not work with the board type Lolin ESP32 C3 mini. It appears that the library is incorrect and this is not supported. There is some discussion about this in the espressif forums indicating that a new version is available.
The BlinkRGB.ino example is part of the library package for the ESP32 boards. It is not in a library that I've added using the Board Manager.
Hi @daledj. The "esp32" boards platform supports hundreds of boards, with very significant differences between each. Some of the libraries and example sketches bundled with the platform are only compatible with a subset of the supported boards.
I think this is communicated reasonably well in the example sketch:
Demonstrates usage of onboard RGB LED on some ESP dev boards.
It is not accurate to say these are "not correct". What is not correct is attempting to use the sketch or library with a board it was not intended to be used with.
Does your "Lolin ESP32 C3 mini" board have an onboard RBG led?
I will report on espressif forum. Yes, my board which is a LOLIN ESP32 C3 Pico does have the color LED. I'm using the board type for LOLIN ESP32 C3 mini, because there is no Pico board type, but from what I can read the boards are equivalent, but the Pico has a battery input and charger on the board.
The "esp32" boards platform is interesting in that the maintainers accept the addition of support for any ESP32-based board by anyone. The developers of the platform don't own all these boards and wouldn't have the time to run tests on all that hardware even if they did. So the idea seems to be that the maintenance of the board-specific code is the responsibility of the people who need that code (the board manufacturer and the users of the board). The platform developers only worry about the code that supports all boards generally and the general purpose "Dev Module" type of board definitions.
So when a new capability is added to the platform code, it is expected that someone will later come along to update the board-specific code to take advantage of the new capability. That is the case here. When the support for boards with built-in addressable RGB LEDs was added, the developers only updated the "Dev Module" board definitions:
Since that time, contributors have added support for various other boards, but nobody happened to do it for the lolin_c3_mini core variant used by the "LOLIN C3 Mini" board definition. So the RGB_BUILTIN macro is not defined when you have this board selected:
But you can use the sketch even though the RGB_BUILTIN macro isn't pre-defined for your board. Just add this line to the top of the sketch:
#define RGB_BUILTIN 7
Yeah, I see from the schematics that the RGB LED's data pin is connected to IO7 on both boards.