We used 5 switches on the OI: 1 for side select, 4 for auton select. Each of the 4 switches represents a bit. We set a variable with these values in Process_Data_From_Master_uP() (which got me to notice the bug in main.c).
For Auton, we do this:
Code:
//...
while (autonomous_mode) /* DO NOT CHANGE! */
{
// Do instructions
switch (AUTON_MODE)
{
case 0:
//Do nothing
break;
case 1:
Auton_1(); break;
case 2:
Auton_2(); break;
case 3:
Auton_3(); break;
//...
}
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata); //DO NOT DELETE, or you will be stuck here forever!
Putdata(&txdata); // DO NOT DELETE, or you will get no PWM outputs!
Generate_PWMs(pwm13, pwm14, pwm15, pwm16);
}
Process_Data_From_Local_IO();
}// End Loop
Then, we wrote the Auton's in seperate files.