UIflow P2P - getP2PData()



  • Does anyone know how https://github.com/m5stack/m5-docs/blob/master/docs/en/uiflow/advanced.md#p2p works - is it ESPnow-like, or are the messages routed via some m5 cloud service? I don't manage to find the source code of it to see for myself yet.

    (I can't get it working, but I'm not sure if it's what I need anyway - I need the messages to work across different wifi networks via Internet.)

    I'm not sure if P2P Read blocks or not.

    PS: Where in UIFlow is simple 'serial print' ?



  • I never use this option, i think the messages was routed via m5cloud service (probably the same mechanism like upload uiflow program via web uiflow with destination device api key)

    You should find orange print block in Text tab. It will generate print(...) function code, but it print message via serial to usb (you should receive text in serial terminal on laptop/pc.



  • it would be nice if someone could show a working example here for connecting two M5stack Core with P2P



  • 0_1609369034040_0c26d482-5d51-4b3b-8211-6cfd03cc039b-image.png

    This works for me. The upper part loops and asks for it's data every 500ms. The lower part sends a message if button A was pressed. They key must be set to the right key of the device to send to.



  • Thank you it works but you have to download it to the core if you only run it to try it out you get an error message.



  • If you download this code to device you should add block to connect to your wifi network

    advanced -> network -> wifi connect

    or

    advanced -> network -> connect to wifi ...