# Program Flow

Basic Workflow:
----------------

Firmware is present in ``affbotics_software/firmware/avg/ESP32_AGV_brain/src/main.cpp``
* Esp32 will connect to the wifi when booted 
* It will read the line sensor and Ultrasonic sensor calculate the values and sends commands to the motor via Modbus

![flowchart.png](https://docs.baseapp.com/uploads/images/drawio/2022-03/drawing-4-1646979290.png)

Am a Geek:
------------
* WiFi ssid and password can be changed by editing ``const char ssid[]`` and ``const char pass[]``
* MQTT broker can be changed by editing the line ``client.connect("esp32", "public", "public" ))`` and ``client.begin("public.cloud.shiftr.io", net);``
* PID values can be tweaked by changing values of variabled ``kp, ki, kd``