Transfer data from ESP32 to Arduino Uno using UART

See example: Using the BD-LLC for Serial, for hooking up the level shifter, which Golum posted, to UART.

I have edited post #30 to demo the sending/receiving of your 2 different commands. sending 0 will instruct the Arduino to lock, sending 1 will instruct Arduino to unlock.

Sender ESP32:

Receiver Arduino:

Yes, keep baud rate at 9600 when using software serial.

Also, if you needed 2-way communication from Arduino UNO to ESP32 and from ESP32 to Arduino UNO, then you cannot send data both ways at the same time, and you will need to program collision avoidance, as software serial cannot handle simultaneous 2 way communication. Some simple additional code can be added for the collision avoidance, however, to keep it simple, I would just switch to the primary Arduino's hardware serial port for this (pins 0 & pin 1) when you are finished prototyping with software Uart. This will require you to disconnect the RX and TX lines when you are uploading a sketch to Arduino.