Added new global variables and functions to the PID controller which is supposed to sync with the main program