Arduino Blink LED_BUILTIN inverted output

Hi,

I have recently bought a xiao-esp32s3 but have encountered a problem. When uploading the Arduino Blink example to the Xiao esp32s3, the output is inverted.

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(1000);                      // wait for a second
  digitalWrite(LED_BUILTIN, LOW);   // turn the LED off by making the voltage LOW
  delay(1000);                      // wait for a second
}

When the LED_BUILTIN is set to LOW the LED_BUILTIN is on, I noticed this when using the LED_BUILTIN to indicate a process was active. When the following code is flashed to the Xiao esp32s3 the LED_BUILTIN will be on as mention earlier, and off if HIGH is written instead of LOW.

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, LOW);   // turn the LED off by making the voltage LOW
}

Have you also experienced this, or do you know how make the Xiao esp32s3 work as expected?
Please let me know!

The XIAO_ESP32S3 hardware is designed so that the LED light up in LOW.
If you want to invert it, you can invert it in your sketch.

Hi there,
Completely Normal. Check the WiKi , Getting Started.

Playing with the built-in 3-in-one LED

Seeed Studio XIAO nRF52840 (Sense) has an onboard 3-in-one LED which is user-programmable. Now you will learn how to control the RGB colors one-by-one using Arduino!

You first have to understand that the behavior of this LED is not as usual when controlled by the code. The LED turns ON when we give a LOW signal and it turns OFF when we give a HIGH signal. This is because this LED is controlled by a common anode and will light up only with a low-level signal.

An example code would be:

void setup() {  pinMode(LED_BUILTIN, OUTPUT);}void loop() {  digitalWrite(LED_BUILTIN, HIGH);   }

Here, even though HIGH is used, the LED will be OFF. You need to replace HIGH with LOW to turn ON the LED.

Refer to the following pin mappings of the LEDs and use them in your codes:

  • Red LED = LED_BUILTIN or LED_RED
  • Blue LED = LED_BLUE
  • Green LED = LED_GREEN

HTH
GL :slight_smile: PJ

Thank you for letting me know where to find the information about the LED!

Getting Started with Seeed Studio XIAO ESP32S3 (Sense) | Seeed Studio Wiki

You will find the schematic.