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

    M5stack new joystick example

    Arduino
    3
    6
    671
    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.
    • Y
      YigalB
      last edited by

      Is there an example how to connect the new joystick (I assumd i2c only) to esp32? How to access the joystick status? Also, is it delivered with firmware installed?

      teastainT 1 Reply Last reply Reply Quote 0
      • teastainT
        teastain @YigalB
        last edited by teastain

        @YigalB I2C is correct.
        Here is the example:
        https://github.com/m5stack/M5Unit-Joystick2/blob/main/examples/get_value/get_value.ino
        The internal firmware is already installed and like most M5Stack Units it is 'permanent' and does not require your attention but could theoretically be updated in the future.

        Cheers, Terry!

        100% M5Stack addict with several drawers full of product!

        Y 1 Reply Last reply Reply Quote 0
        • Y
          YigalB @teastain
          last edited by

          @teastain Thank you! Exactly what I needed to know.

          Another thing that bothers me: When looking at the I2C protocol in the documentation, it states the "I2C address" is RW (read write).

          1. I assume the Write part is in order to change the address - probably in order to include 2 joysticks at same time. Is this command stored on a non volatile memory? Or is it needed to be executed every power up?
          2. if 2 joysticks are connected in parallel, how is it possible to direct the command from the master to a specific one?

          Of course, if the answer to 1 is yes, this can be easily done with step by step.
          (or if there are jumpers on board the joystick).

          teastainT 1 Reply Last reply Reply Quote 0
          • teastainT
            teastain @YigalB
            last edited by teastain

            @YigalB Two Joysticks would require a PaHub accessory from M5Stack:
            https://shop.m5stack.com/products/i2c-hub-1-to-6-expansion-unit-pca9548apw
            These work very well, seamlessly.
            I don't know how to change the I2C address of the Joystick in this register, sorry.

            Cheers, Terry!

            100% M5Stack addict with several drawers full of product!

            Y 1 Reply Last reply Reply Quote 0
            • Y
              YigalB @teastain
              last edited by

              @teastain Yes, using I2C splitter is a practical solution for using I2C devices with same address. I use it often.
              Yet the "Write" ability caught my attention, since it is saving the need for the splitter.

              I will try approaching the customer service.

              felmueF 1 Reply Last reply Reply Quote 0
              • felmueF
                felmue @YigalB
                last edited by

                Hello @YigalB

                yes, the I2C address is stored in flash. There is no need to repeat that step (changing I2C address) after every power up. It just needs to be done once.

                Alternatively you can use a PaHub like @teastain suggested.

                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