arduinoarduino-esp32

ESP32-S3 board is not blinking on pin 48


I reset the ESP32-S3 board and uploaded simple blink code, but nothing happens

#define LED_BUILTIN 48 

void setup() {
  // put your setup code here, to run once:
  pinMode(LED_BUILTIN,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
 digitalWrite(LED_BUILTIN,HIGH);
 delay(1000);
 digitalWrite(LED_BUILTIN,LOW);
 delay(1000);
}

Solution

  • ESP32 Arduino platform for some ESP32 boards in pins_arduino.h has a definition of LED_BUILTIN. For example for the "ESP32S3 Dev Module" it is:

    #define PIN_NEOPIXEL        48
    static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT+PIN_NEOPIXEL;
    #define LED_BUILTIN LED_BUILTIN  // allow testing #ifdef LED_BUILTIN
    #define RGB_BUILTIN LED_BUILTIN
    #define RGB_BRIGHTNESS 64
    

    The LED_BUILTIN here has a strange value SOC_GPIO_PIN_COUNT+PIN_NEOPIXEL. This is to distinguish normal use of the IO pin from use for the on-board RGB LED. In digitalWrite if the pin is RGB_BUILTIN they invoke neopixelWrite instead of gpio_set_level which is executed for all normal IO pins including 48.

    The neopixelWrite function then uses the Neopixel protocol to communicate with the on-board RGB LED.

    So don't redefine LED_BUILTIN but use the one already defined in pins_arduino.h.