This is a very simple example code of how to work with the WLED json api over serial using PlatformIO and the ArduinoJson library.
With the help of the wled json api you are able to use all api commands to control a wled-flashed-mcu with any other serial capable microcontroller.
In my example sketch by pressing a button which is conntected to the sending-mcu it will change the color of the led-strip on the wled-mcu.
- sending-µC: esp32
- receiving-µC: esp8266
- wled version: "WLED-0.13.0-b6"
- baud rate: 115200
- tested baudrates: 115200, 230400, 460800, 500000, 921600, 1000000, 1500000
SoftwareSerial is only suitable for very slow baud rates, definitely not 921600. You should always use HardwareSerial if possible, and in case SoftwareSerial is indispensable, use the lowest possible rate.
- esp32 pin 2(RX) <-> esp8266 pin 1(TX)
- esp32 pin 4(TX) <-> esp8266 pin 3(RX)
- esp32 gnd <-> esp8266 gnd