Overview | Main | State Machine | Events | IR | Tape | Drivetrain | PWM | Flash | Two Minute Timer | Bump
void main(void): the main function for the robot
The main module is responsible for initializing all of the necessary low-level modules and microprocessor subsystems and determining various parameters of the initial state of the robot. It then enters an (intentionally) infinite loop to run the event-driven state machine “brain” of the robot.
PSEUDOCODE
(Download Pseudocode .doc 26kb)
void main(void)
    Initialize the drivetrain module
    Initialize the tape sensor module
    Initialize the IR sensor module
    Enable interrupts
    Determine which state machine should be run, main play or sudden death
    Determine which team the robot is playing for, red or green
    Repeat forever
        Read the tape sensors
        Check for events
        If there has been an event
            Pass the event to the active state machine
    

