I have a Nano ESP32 with two I2C sensors attached which delivers their measurements to an MQTT Broker. Recently, following a power cut the MQTT Broker became unavailable (it started up with a different IP address from that hard-coded in my sketch). Consequently the code jumps to a function to handle connection errors and either disconnects and reconnects the wifi, or disconnects and reconnects the MQTT Broker, and if neither work it tries to restart the ESP (though I don't think that works or is called because it doesn't seem to get restarted).
The tangible result is that RGB LED starts colour cycling, about once every 2 seconds or so.
This is annoying. The Nano is installed in the enclosure of an All-Sky Camera, a device which takes long exposure (30 seconds) photos of the whole sky with a 180 degree fish-eye lens. These are then put together into a movie at the end of the night. This RGB LED causes coloured patches to be reflected from the inside of the protective acrylic dome.
I solved the permanent power LED by removing it from the board and in principle I could do the same with this one, but i would prefer to find a more elegant solution. How can I disable this activity in software.
It is working! The part of your code that says "if (this) then red, if (that) then green, if (other) then blue" is seeing "this, that" and "other" and performing perfectly.
Have a look here (under RGB)
and here where it tells you how to fix the code for a RGB led which has the colors in a different order.
Navigate to packages/arduino/hardware/esp32/<version>.
Open io_pin_remap.cpp in a text editor.
Find the following lines:
[LED_RED] = 46,
[LED_GREEN] = 0,
[LED_BLUE] = 45, // RTS
Edit them so they look like this:
[LED_RED] = 46,
[LED_GREEN] = 45, // RTS
[LED_BLUE] = 0,
Save the changes to io_pin_remap.cpp.
This shows the actual ESP32 pins where the LED is connected. I am not familiar with the ESP32-S3 that much but there is a chance that these are also strapping pins or may have pullups connected, or that it just cycles through it as part of the startup cycle (i was going to say bootloader, but it isn't a bootloader). In case of the latter you may be able to circumvent this by using different pin nrs or have a really long look through the rest of the core,