It will ' put the robot into a known state. Input switches are active low. Behave is the routine that determines the robots behaviour. If the TurnDelayCount is Zero, then we can ' go forward. Otherwise, we will continue to ' turn in the TurnDelayCount direction.
All programs have a starting point.
The Main routine is called when the controller resets or is powered up. Its job is to initialize variables, setup ports, and get the robot into a known state. I usually like to get the initialization done, then print a message to either the serial port or to an LCD display if one exists. Code after the final loop should never get executed, and therefore ' shouldn't exist. If you are paranoid, then you should put in some ' code to stop the robot in its tracks, and shutdown.