code example for remote control between two M5stacks



  • 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 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.



  • 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



  • 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.



  • 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?



  • 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.



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

    list = eval(springtosend)



  • 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.