Working Environment
Basic Workflow

Functions in the code
Tools:
Enveronment: void
connect()
Connects to the Wifi and MQTT broker
PlatformIO
Framework: void
messageReceived()
Callback function if MQTT message is recieved
Arduino
Code voideditor: Visual doCommunication()Studio
Function running on second core of esp32 to manage WiFi and communicate with MQTT broker
Code
void
pid()
PID algorithm function, takes input and output variables. This funcrion updates the output variable after calculating the PID.
Hardware:
Mcu: intESP
getRange()
Get distance from ultrasonic sensor, takes sensor pin number as input
void
checkObstruction()
Thread function which runs continuously and cheaks for any obstruction in the path and update the variable.
void
connect()
Connects to the Wifi and MQTT broker
void
preTransmission()
void
postTransmission()
Set MAX485 to recieve or transmitt mode