Confused how to communicate esp8266 12e with arduino nano

The problem is that when the sensor detects something, the motors do not stop.
The wheels are connected to the l298n motor driver