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

    microPython on esp32 C3 mate error InvalidPin when use GP19 for relay.

    Micropython
    3
    3
    1.8k
    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.
    • S
      Sebastien Jourdan
      last edited by

      User
      Hi,
      With microPython on esp32 C3 mate, I would like to use a 3A Relay unit, for that I use GP19 which are also dedicate for USA D+, with the following code:
      '''python3
      import machine
      ...
      relay = machine.Pin("GP19", machine.Pin.OUT)
      ...
      if temp > 42:
      ...
      relay.value(1)
      elif temp < 40:
      ...
      relay.value(0)
      else:
      pass
      ...
      '''

      But I have this error:
      Traceback (most recent call last):
      File "main.py", line 7, in <module>
      ValueError: invalid pin

      Do you know why?
      Is it possible to use GP19 for a relay even if this Pin is dedicate to USA D+?

      Thanks you,
      Sebastien

      1 Reply Last reply Reply Quote 0
      • stjofrS
        stjofr
        last edited by

        Why don't you use the 1st argument (pin number) in integer format ?

        Stef Code
        Project Management Director and Editor
        in Database Software Systems Development
        https://stjo.fr

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

          the GP is not required, only numbers are required.

          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