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):
digitalWrite(onboard_led, !HIGH);
, where the HIGH indicates you want it to turn on, and the!
inverts it automagically.