user58373: On an ESP32 board I am trying this simple code to control the onboard led.
But if I set it to HIGH, led is OFF, if I set it to LOW, led is ON (fully bright).
What could cause this ?
The board has one red and one blue leds, the blue one is the one that can be controlled.
#define onboard_led 2

void setup() {
  pinMode(onboard_led, OUTPUT);
}

void loop() {
    digitalWrite(onboard_led, HIGH);
    // digitalWrite(onboard_led, LOW);
}

Edit: it was a board like this ("Geekcreit" I think):


user69592: As this image from Okdo Page on LED Driving shows, there are two ways to drive an LED from a GPIO output pin:

In the Active HIGH case, a HIGH output on the GPIO will turn the LED on since that will source current out of the pin and through the LED into ground.
In the Active LOW case, a LOW output on the GPIO will sink current from the +V supply into the pin.
In your case the LED is hooked up in the Active LOW configuration and so to turn it ON you must set the pin to LOW.
I'll add that these ESP32 boards are made by many different manufacturers and they are not all identical.

58373: <p>On an <code>ESP32</code> board I am trying this simple code to control the onboard led.</p>
<p>But if I set it to <code>HIGH</code>, led is <strong>OFF</strong>, if I set it to <code>LOW</code>, led is <strong>ON</strong> (fully bright).
What could cause this ?</p>
<p>The board has one red and one blue leds, the blue one is the one that can be controlled.</p>
<pre><code>#define onboard_led 2

void setup() {
  pinMode(onboard_led, OUTPUT);
}

void loop() {
    digitalWrite(onboard_led, HIGH);
    // digitalWrite(onboard_led, LOW);
}
</code></pre>
<p><strong>Edit:</strong> it was a board like this (&quot;Geekcreit&quot; I think):</p>
<p><a href="https://i.stack.imgur.com/trxBg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/trxBg.jpg" alt="enter image description here" /></a></p>
 69592: <p>As this image from <a href="https://www.okdo.com/project/gpio-led/?ok_ts=1605113937103" rel="nofollow noreferrer">Okdo Page on LED Driving</a> shows, there are two ways to drive an LED from a GPIO output pin:</p>
<p><a href="https://i.stack.imgur.com/SRvCl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SRvCl.png" alt="https://www.okdo.com/project/gpio-led/?ok_ts=1605113937103" /></a></p>
<p>In the Active HIGH case, a HIGH output on the GPIO will turn the LED on since that will source current out of the pin and through the LED into ground.</p>
<p>In the Active LOW case, a LOW output on the GPIO will sink current from the +V supply into the pin.</p>
<p>In your case the LED is hooked up in the Active LOW configuration and so to turn it ON you must set the pin to LOW.</p>
<p>I'll add that these ESP32 boards are made by many different manufacturers and they are not all identical.</p>
