Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Expansion Board 3 user button Pin

    Scheduled Pinned Locked Moved Expansion Board
    10 Posts 7 Posters 286 Views 7 Watching
    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.
    • G Offline
      goldfishalpha
      last edited by

      Apologies if this is dumb and repeated question but, I don't seem to be able to find a definitive answer anywhere.

      What Pin is the user button on the expansion board 3 (3.1 in my case) connected to?

      J N 3 Replies Last reply Reply Quote 1
      • J Offline
        jcaron @goldfishalpha
        last edited by jcaron

        @goldfishalpha the completely useless Pycom documentation with its many different and conflicting numbering schemes strikes again.

        I believe it’s P14, but given the fact that it has different names (including two different GPIO* names), one can be excused if they don’t get it right.

        Pycom, are you ever going to do something about this?

        1 Reply Last reply Reply Quote 3
        • K Offline
          kjm
          last edited by

          In a shock move today Pycom have announced they are ditching the three competing pin ID schemes in favour of labelling them with the names of Saturn's moons. Starting at the reset button & proceeding towards the wifi antenna connector the new pin notations are Titan, Enceladus, Mimas, .....etc, with G42/GPIO21/P12 now known as Methone.

          1 Reply Last reply Reply Quote 4
          • N Offline
            netskink @goldfishalpha
            last edited by

            @goldfishalpha

            I got it to work using G17.

            pin = Pin('G17', mode=Pin.IN, pull=Pin.PULL_UP)
            print(pin())
            
            1 Reply Last reply Reply Quote 1
            • N Offline
              netskink @goldfishalpha
              last edited by

              @goldfishalpha

              FWIW, I am using the code below to work with S1. I am trying to use a timer to debounce the button press. This will fail on long button presses. Any advice is appreciated.

              from machine import Pin
              from machine import Timer
              
              # Exapansion board S1 is P10 / G17
              
              # When not pressed, this code will read 1
              # When pressed, this code will read 0
              pin = Pin('P10', mode=Pin.IN, pull=Pin.PULL_UP)
              # print(pin())
              
              
              
              # P-Number	G-Number	GPIO
              # P0	    G2	        GPIO3
              # P1	    G1	        GPIO1
              # P2	    G23	        GPIO0
              # P3	    G24	        GPIO4
              # P4	    G11	        GPIO15
              # P5	    G12	        GPIO5
              # P6	    G13	        GPIO27
              # P7	    G14	        GPIO19
              # P8	    G15	        GPIO2
              # P9	    G16	        GPIO12
              # P10	    G17	        GPIO13
              # P11	    G22	        GPIO22
              # P12	    G28	        GPIO21
              # P13	    G5	        GPIO36
              # P14	    G4	        GPIO37
              # P15	    G0	        GPIO38
              # P16	    G3	        GPIO39
              # P17	    G31	        GPIO35
              # P18	    G30	        GPIO34
              # P19	    G6	        GPIO32
              # P20	    G7	        GPIO33
              # P21	    G8	        GPIO26
              # P22	    G9	        GPIO25
              # P23	    G10	        GPIO14
              
              # Robert-hh Corrections
              #
              # P1=G1=GPIO1
              # P10=G18=GPIO13
              # P19=G6=GPIO32
              # P21=G8=GPIO26
              # P23=G10=GPIO14
              
              
              # Ensure handler is not registered
              pin.callback(Pin.IRQ_FALLING | Pin.IRQ_RISING, handler=None)
              
              
              # The callback routine is not debounced
              # The print message below could happen multiple times
              def pin_handler_non_debounced(arg):
                  print("got an interrupt on pin %s" % (arg.id()))
              
              # pin.callback(Pin.IRQ_FALLING | Pin.IRQ_RISING, pin_handler_non_debounced)
              
              
              # Long presses will still trigger multiple key detects
              def pin_handler_debounced(arg_is_pin):
                  #print("pin_handler_debounced()")
              
                  # Disable the callback until we exit
                  # Option 1 - use pin.callback()
                  #  This is a global, we are using a reference.
                  #  use global pin if we want to change the value
                  # Option 2 - use arg
                  #  The pin which generate the callback is passed in to handler
                  arg_is_pin.callback(Pin.IRQ_FALLING | Pin.IRQ_RISING, handler=None)
              
                  chrono = Timer.Chrono()            # create timer
                  chrono.reset()                    # reset timer to zero
                  chrono.start()                    # start timer
                  start_time_ms = chrono.read_ms()  # start timer
                  end_time_ms = start_time_ms
                  # Ignore pin interrupts for 1000 ms
                  while(end_time_ms < (start_time_ms + 1000)):
                      #print("chrono read_ms")
                      #print("End time %d" % (end_time_ms))
                      #print("Start time %d" % (start_time_ms))
                      end_time_ms = chrono.read_ms()
              
                  print("got an interrupt on pin %s" % (arg_is_pin.id()))
              
                  # Re-enable the callback
                  arg_is_pin.callback(Pin.IRQ_FALLING | Pin.IRQ_RISING, pin_handler_debounced)
              
              
              
              
              pin.callback(Pin.IRQ_FALLING | Pin.IRQ_RISING, pin_handler_debounced)
              
              1 Reply Last reply Reply Quote 0
              • T Offline
                TurkDangerCat
                last edited by

                Yes, what the hell is going on with the bizarre number schemes?! At least have have pin numbers that relate to the physical locations of the bloody pins, you know, like pin one is the first pin! Then everything else can hang off that for the different pin functions. I am 50/50 going to abandon my plans to use Pycom as it's taking me hours to work out what is and isn't connected to what!

                rcolisteteR 1 Reply Last reply Reply Quote 1
                • rcolisteteR Offline
                  rcolistete @TurkDangerCat
                  last edited by

                  @TurkDangerCat See my Guide/Tutorial/Reference about Expansion Board, specially the end of section "1. Documentation".

                  My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

                  T 1 Reply Last reply Reply Quote 1
                  • T Offline
                    TurkDangerCat @rcolistete
                    last edited by

                    @rcolistete Thanks for that, helpful, one small thing, you may have a typo here: "low power consumption in deep sleep mode, minimum of 34 mA with WiPy3 and battery supplying 3.61-3.66 V in the JST PH 2.0 connector, similar to the 33 uA promised by Pycom;"

                    Did you mean mA and uA (as 34mA is not close to 33uA :-) )

                    Not sure any of that helps me much though, I am designing a number of boards and trying to rely upon such poorly written and inconsistent documentation (by Pycom) means I am taking a much bigger risk adding a LoPy to my design than I should. I can't even find any mechanical diagrams for the expansion boards.

                    rcolisteteR 1 Reply Last reply Reply Quote 2
                    • G Offline
                      Gijs
                      last edited by

                      Hi,

                      Thanks for the feedback! I have been working to improve the documentation, it just takes a lot of my time. I will add the information once I get there! Your additional instructions / documentation looks really nice!

                      Best,
                      Gijs

                      1 Reply Last reply Reply Quote 1
                      • rcolisteteR Offline
                        rcolistete @TurkDangerCat
                        last edited by rcolistete

                        @TurkDangerCat said in Expansion Board 3 user button Pin:

                        @rcolistete Thanks for that, helpful, one small thing, you may have a typo here: "low power consumption in deep sleep mode, minimum of 34 mA with WiPy3 and battery supplying 3.61-3.66 V in the JST PH 2.0 connector, similar to the 33 uA promised by Pycom;"

                        Did you mean mA and uA (as 34mA is not close to 33uA :-) )

                        Yes, it was a typo, the correct is 34 uA. Thanks, I've fixed it.

                        My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

                        1 Reply Last reply Reply Quote 2

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • 1 / 1
                        • First post
                          Last post

                        Pycom on Twitter

                        Pycom