https://youtu.be/lK4v-6xzSEA
This post will tell you everything you need to know about MQTT communication which will enable you to use it communicate between devices. We add an LED to the Arduino Nano 33 IoT board and this LED is controlled remotely from a switch that is connected to a WeMos D1 mini board. All communication occurs through the MQTT broker which also communicates with Home Assistant.