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

    PaHub Code issue in UIFlow2

    UiFlow 2.0
    2
    9
    2.0k
    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 ajb2k3

      @m5stack I'm trying to write an example of using the PaHub in UIFlow2 but found a bug:

        env3_0 = ENVUnit(i2c=i2c0, type=3)
        env4_0 = ENVUnit(i2c=PAHUBUnit(i2c=i2c0, channel=0), type=4)
        pahub_0 = PAHUBUnit(i2c=i2c0, channel=0)
      

      Should be:

        env3_0 = ENVUnit(i2c=PAHUBUnit(i2c=i2c0, channel=1), type=3)
        env4_0 = ENVUnit(i2c=PAHUBUnit(i2c=i2c0, channel=0), type=4)
        pahub_0 = PAHUBUnit(i2c=i2c0, channel=0)
      

      but no matter what I try, the Pahub always crashes with "device not found"

      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 @ajb2k3

        remember, PaHub and ENVIII share the same I2C address (0x70) by default, e.g. if not modified. As discussed here.

        Thanks
        Felix

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

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

          @felmue said in PaHub Code issue in UIFlow2:

          Hello @ajb2k3

          remember, PaHub and ENVIII share the same I2C address (0x70) by default, e.g. if not modified. As discussed here.

          Thanks
          Felix

          Thanks but I have an issue with solving your code. in the line:
          env3_0 = ENVUnit(i2c=PAHUBUnit(i2c=i2c0, channel=0, address=0x71), type=3)

          You have attached the Address to the ENV but we need to override the pahub_0 definition to include the address or it still looks to address 0x70 and this I can't work out.

          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 @ajb2k3

            the additional address parameter is for the PaHub. E.g. I modified the PaHub to use I2C address 0x71 (instead of default address 0x70).

            BTW: ENVIII alternate I2C address is 0x56.

            Thanks
            Felix

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

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

              @felmue said in PaHub Code issue in UIFlow2:

              Hello @ajb2k3

              the additional address parameter is for the PaHub. E.g. I modified the PaHub to use I2C address 0x71 (instead of default address 0x70).

              BTW: ENVIII alternate I2C address is 0x56.

              Thanks
              Felix

              I've changed the Hub address to 71 but the definition is for pahub_0 but you code has env defined as PAHUBUnit
              hence the confusion

              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 felmue

                Hello @ajb2k3

                please find an example in the UIFlow2 Project Zone called M5Dial_PbHub_EnvIII_EnvIV.

                It features an M5Dial, PaHub (modified I2C address 0x71), Env III (channel 0) and Env IV (channel 1).

                M5Dial
                   |
                PaHub (0x71) -|
                              |- ch0 - ENV III (0x44, 0x70)
                              |- ch1 - ENV IV (0x44, 0x76)
                

                Is that what you are looking for?

                BTW: my code has env defined as PAHUBUnit because the Env III and Env IV are connected to channel 0 and channel 1 of the PaHub.

                Thanks
                Felix

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

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

                  Thanks but just a note for your example, Use the execute code but ad a hash (#) before the note

                  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
                  • ajb2k3A
                    ajb2k3
                    last edited by

                    Thanks here we are
                    0_1708196918513_Screenshot 2024-02-17 at 19.08.18.png

                    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 @ajb2k3

                      nice! And thanks for the tip with the # before the note.

                      Thanks
                      Felix

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

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