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

    code example for remote control between two M5stacks

    UIFlow
    4
    8
    11.1k
    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.
    • ArnoA
      Arno
      last edited by

      I am new to my M5stacks. I have a M5stack gray and a core2, I want with ESP NOW to communicate the X, Y and Z values of the gyro of the core2 and enter them as variable X, Y and Z in the M5STACK Gray.
      By following the documentation I manage to communicate ON / OFF between the two systems but not with numerical values.

      Thanks in advance for your help in my new hobby!1_1610906783123_ESP NOW Gyro Gray.PNG 0_1610906783121_ESP NOW Gyro C2.PNG

      I only use Uiflow ! with M5STACK Gray, RED, CORE2, ATOM, ATOM Lite,M5Paper, M5Tough, ATOM Display, M5 Stamp pico and more Unit...

      1 Reply Last reply Reply Quote 0
      • R
        ramaker
        last edited by

        I have a similar problem. I want to control an autonomous vehicle.
        Like you I get the communication working, but I can only transfer strings.
        If you look to the micropython view, you can see, that there is an encoder declaration "str".
        If you send numerical values, they are converted to "str" too.

        I don't know if there are other possibilities - I asked in forum and support, but I get no satisfiing answer.

        Now I'm transfering strings and then convert them back to numerical values in the receiver.
        K.D.

        1 Reply Last reply Reply Quote 0
        • ArnoA
          Arno
          last edited by

          I have the same project to build an autonomous ROVER as a first step with ultrasound and TOF sensors and a remote control with a FACE gameboy and telemetry.
          I also block to exchange data in ESP NOW.0_1611911655795_DSCN1339.JPG 0_1611911701224_DSCN1327.JPG

          I only use Uiflow ! with M5STACK Gray, RED, CORE2, ATOM, ATOM Lite,M5Paper, M5Tough, ATOM Display, M5 Stamp pico and more Unit...

          1 Reply Last reply Reply Quote 0
          • R
            ramaker
            last edited by

            Super !!!
            I'm building a Tiger 1 tank - from original drawings - bought from a man from Korea.
            I have to scale it, so I used to stl files to create the parts in Fusion360. (first version only for indoor use)
            I'm using a SnapMaker A350 to print the big parts and an Ultimaker 3 to print the small parts.

            I want to use a M5Stack Fire for controlling motors, servo, ToF sensor etc.
            A M5Stack Face unit is used as remote.
            Communication between is ESPNow; I stoppt to look for a solution to transfer numerical values.
            I take the values - transfer it as string ( format <command><value> i.e. G100 = Geschwindigkeit(speed) 100)

            In the M5Stack Fire I separate the string to a command character and a value string and then convert that value string to a numerical value. (MATH - covert to integer) Very simple- 3 blocks.

            here is my site: www.r-a-maker.de
            regards
            K.D.

            1 Reply Last reply Reply Quote 0
            • ArnoA
              Arno
              last edited by

              Very nice project, I saw your 3D plans with the integration of the M5stack in the chassis., Great!
              I suggest you exchange .m5f on data transfer in ESP NOW?

              I only use Uiflow ! with M5STACK Gray, RED, CORE2, ATOM, ATOM Lite,M5Paper, M5Tough, ATOM Display, M5 Stamp pico and more Unit...

              1 Reply Last reply Reply Quote 0
              • R
                ramaker
                last edited by

                Yes - I'm using ESPNow and 2 M5Stack units: M5Stack Fire is integrated in the vehicle and M5Stick Faces ist the "RC controller".
                I split the jobs: in RC mode the faces calcutates the speed of the motors dependent on the forward/backwards , left/right command. I can drive soft curves or rotate the vehicle on the spot. I can pivot the turret left and right. In the next version the M5 AI camera will be included.
                If I change the mode to AUTONOMOUS, then the Fire is doing the measurements (rotate a ToF sensor) and try to find a way. The Face is only an "emergency stop" and gives a "going home" command.

                1 Reply Last reply Reply Quote 0
                • A
                  aa87
                  last edited by

                  You could use eval() to get your data back.
                  Example:
                  springtosend = str(list[1, 2, "hello"])

                  list = eval(springtosend)

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

                    You can send the values as a json string from the ROV to the remote and then separate the values from the sting on the receiving end.
                    I am currently documenting this in my esp-now document.

                    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