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

    PaHub Access cracked.

    Units
    3
    10
    16.4k
    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.
    • ajb2k3A
      ajb2k3
      last edited by

      Yes, I am finially able to access 1 of the channels on the PaHub!

      from m5ui import *
      from uiflow import *
      import i2c_bus
      import unit
      
      setScreenColor(0x222222)
      tof1 = unit.get(unit.TOF, unit.PORTA)
      
      
      
      label1 = M5TextBox(89, 38, "Text", lcd.FONT_Default,0xFFFFFF, rotate=0)
      label2 = M5TextBox(69, 116, "Text", lcd.FONT_Default,0xFFFFFF, rotate=0)
      
      
      i2c0 = i2c_bus.easyI2C(i2c_bus.PORTA, 0x70)
      while True:
        i2c0.write_u8(0x00, 0x01)
        label2.setText(str(tof1.distance))
        wait_ms(2)
      

      I am using the tof here for this.

      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
      • M
        maechler
        last edited by

        Thanks for sharing! Do you also have an example on how to connect multiple sensors to the PaHub and read values from them?

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

          Sorry, haven't had the time to revisit this how ever I think that it should be

          tof1 = unit.get(unit.TOF, unit.PORTA)
          tof2= unit.get(unit.TOF, unit.PORTA)
          
          
          label1 = M5TextBox(89, 38, "Text", lcd.FONT_Default,0xFFFFFF, rotate=0)
          label2 = M5TextBox(69, 116, "Text", lcd.FONT_Default,0xFFFFFF, rotate=0)
          
          
          i2c0 = i2c_bus.easyI2C(i2c_bus.PORTA, 0x70)
          i2c1 = i2c_bus.easyI2C(i2c_bus.PORTA, 0x71)
          
          while True:
            i2c0.write_u8(0x00, 0x01)
            label2.setText(str(tof1.distance))
            wait_ms(2)
          
          

          or something like this

          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
          • lukasmaximusL
            lukasmaximus
            last edited by

            Seems your over complicating things a little @ajb2k3 We apologise that there has been very little info on how to connect multiple sensors up to the PaHub, I also was struggling to set up a bunch of sensors before someone on the dev team showed me. But it is as simple as selecting your desired unit in the units tab and selecting pahub from the dropdown list instead of port a.
            0_1566978740475_Screen Shot 2019-08-28 at 15.18.21.png
            Then you must select the port of the Pahub you wish to connect to. The port numbers are labelled on the pcb if you look closely.
            0_1566978833032_WechatIMG227 copy.jpeg
            Then this was the code I wrote for a parking proximity alarm
            0_1566978915935_Screen Shot 2019-08-28 at 15.34.08.png
            Hope this helps. If you want me to send the resulting python script I can also send it

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

              @lukasmaximus my code is before the Pahub was added to UIFlow and I haven’t had the time to check out the pahub blocks added yet

              Sweet you can now select the hubs ports. I didn’t know that.

              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
              • M
                maechler
                last edited by

                @lukasmaximus and @ajb2k3 Thank you very much for your answers!

                I am working with Visual Studio Code and UIFlow-v1.3.2. But I use flow.m5stack.com to look up how to connect the sensors. I was confused because PaHub is greyed out there:

                0_1567243286766_Screenshot 2019-08-31 at 11.19.06.png

                Thanks for showing how to select the PaHub, however it does still not work for me. Even with the simplest possible example in UI Flow I get the following error: 'module' object has no attribute 'PAHUB0'

                from m5stack import *
                from m5ui import *
                from uiflow import *
                import unit

                setScreenColor(0x000000)
                env1 = unit.get(unit.ENV, unit.PAHUB0)

                If I connect the same unit to unit.PORTA everything works fine. I would like to be able to connect EARTH, ENV and LIGHT units using the PaHub. Is it possible that not all units are supported yet?
                E.g. for the EARTH unit I can not select PaHub using the drop down you showed.

                Thanks for your help!

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

                  The PaHub will be "Grayed Out if the firmware is not updated and you are using the wrong version of UIFlow.
                  Also the PaHub does NOT work with the M5Stick.

                  I will try to make a video on the PaHub this weekend but I'm heckticly busy.

                  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!

                  M 1 Reply Last reply Reply Quote 0
                  • M
                    maechler @ajb2k3
                    last edited by maechler

                    @ajb2k3 I am using a regular M5Stack Core. So which version of UIFlow should I be using?

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

                      @maechler 1.3.5 beta sorry in and out of the forum

                      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!

                      M 1 Reply Last reply Reply Quote 0
                      • M
                        maechler @ajb2k3
                        last edited by

                        @ajb2k3 Thanks, it does work with 1.3.5 beta!

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