M5StickC built in LED
-
Any insight on how the red led on pin 10 of the M5StickC is wired up?
I noticed that, using the Arduino IDE
pinMode(10, OUTPUT);
turns the LED on and subsequently
digitalWrite(10, HIGH);
turns it OFF, while
digitalWrite(10, LOW);
turns it ON again -
Its common to wire a LED to a GPIO (pin) as Active "Low".
One pin of the LED gets wired to +V and the other pin goes to the GPIO.
At some point there is most likely a resister to limit the current.Apparently its easier (less heat?) for the GPIO (pin) to source power by pulling the circut "low".
-
(I'll go ahead and bump this. So sue me.)
Bear in mind that when you initialize the pin with:
M5.begin();
...
pinMode(M5_LED, OUTPUT);
digitalWrite (M5_LED, HIGH); // turn off the LEDThe LED will blink briefly. I don't know of a workaround. I also know virtually nothing about ESP pin frobbing.
-
It’s a oddity that some pins on the esp32 variant often work backwards
-
Hello @wsanders
I don't see the brief blink myself, but have you tried to swap the two statements?
Thanks
Felix -
Thanks! That workaround works.
You only see the brief flash when applying power or when the IDE uploads the code and hard resets via RTS.
If you do this:
#include <M5StickCPlus.h>
void setup() {
M5.begin();
digitalWrite (M5_LED, HIGH); // turn off the LED
pinMode(M5_LED, OUTPUT);
digitalWrite (M5_LED, HIGH); // off
}
void loop() {
delay(10);
ESP.restart();
}the LED does not flash repeatedly.