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

    Can we use GPIO36 as Servo control pIn ?

    M5Stack Fire
    3
    4
    528
    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.
    • R
      RuriObb
      last edited by

      Hello.

      I'm trying to use M5Stack FIRE V2.7 portB(GND, 5V, GPIO26, GPIO36) as Servo motor control pin. The purpose is that two Servo motors ( SG-90 ) connected to portB can be controlled by software.

      First of all, I tested one Servo motor connected to portB (GND, 5V, GPIO26) by using the following Arduino IDE sketch, and it works well.
      But the same Servo motor connected to portB (GND, 5V, GPIO36) doesn't work by using the same Arduino IDE sketch with replacing pin number 26 to 36.
      It seems that GPIO36 pin cannot be set to OUTPUT mode.

      #include <M5Stack.h> //Board : M5Stack-FIRE
      #include <esp32-hal-ledc.h>
      #define LOW 1500
      #define HIGH 8500
      #define TIMER_WIDTH 16
      #define PIN 26 // PIN should be set to 36, if GPIO36 is used

      void setup() {
      M5.begin();
      pinMode(PIN, OUTPUT);
      ledcSetup(1, 50, TIMER_WIDTH);
      ledcAttachPin(PIN, 1);
      }

      void loop() {
      for(int i = LOW; i < HIGH; i = i + 100) {
      ledcWrite(1, i);
      delay(100);
      }
      }

      I don't know the reason why GPIO36 cannot be used as Servo motor control pin.
      Furthermore, I opened M5Stack FIRE cover, and connected Servo motor to GPIO pins directly, but the result is the same as ever.

      Please help, if you have any advice or information on it.
      Thank you In advance.

      RuriObb

      felmueF ajb2k3A 2 Replies Last reply Reply Quote 0
      • felmueF
        felmue @RuriObb
        last edited by felmue

        Hello @RuriObb

        ESP32 GPIO36 is one of the few pins which can only be used as input. See note here.

        GPI: GPIO34-39 can only be set as input mode and do not have software-enabled pullup or pulldown functions.

        Thanks
        Felix

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

        1 Reply Last reply Reply Quote 0
        • R
          RuriObb
          last edited by

          GPIO36が入力専用であることを理解しました。
          情報をありがとうございました。

          RuriObb

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

            @RuriObb No, it is an input pin only. as specified in the various my stack documents.

            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
            • First post
              Last post