🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5StickC built in LED

    M5 Stick/StickC
    5
    6
    13.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      wikistik
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • K
        Kyklist
        last edited by

        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".

        W 1 Reply Last reply Reply Quote 0
        • W
          wsanders @Kyklist
          last edited by wsanders

          (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 LED

          The LED will blink briefly. I don't know of a workaround. I also know virtually nothing about ESP pin frobbing.

          1 Reply Last reply Reply Quote 0
          • ajb2k3A
            ajb2k3
            last edited by

            It’s a oddity that some pins on the esp32 variant often work backwards

            UIFlow, so easy an adult can learn it!
            If I don't know it, be patient!
            I've ether not learned it or am too drunk to remember it!
            Author of the WIP UIFlow Handbook!
            M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

            1 Reply Last reply Reply Quote 0
            • felmueF
              felmue
              last edited by

              Hello @wsanders

              I don't see the brief blink myself, but have you tried to swap the two statements?

              Thanks
              Felix

              GPIO translation table M5Stack / M5Core2
              Information about various M5Stack products.
              Code examples

              W 1 Reply Last reply Reply Quote 0
              • W
                wsanders @felmue
                last edited by wsanders

                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.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post