Thanks to the wide variety of shields offered by the ESP8266-based Wemos development board, we can recycle any toy that has a 5v DC motor and give it a new life!
In order to control our locomotive, we need to have knowledge about MQTT and know how to send commands to the Wemos with the EasyESP firmware (See section STEPS)
IR Infrared Sensor
Download EasyESP (Mega version for ESP8266) and flash our Wemos with the corresponding firmware.
Configure a broker MQTT with controller type "Home Assistant (openHAB) MQTT"
Add devices :
Motor shield: SDA: GPIO-4 (D2) SCL: GPIO-5 (D1)
Sensor IR: GPIO-16 (D0)
Execute commands to check that sensor it's okey:
Open UI M5Flow and upload the example code for M5Stack Core 2 Download NOTE: Change connection parameters for broker MQTT