If you search for “VEXCode PID” on VEXForum you will find plenty of examples on how to code a PID algorithm: