Okay, I programmed the LCD to switch programs in driver control, as this is the task run when the robot is turned on.However, the referee in the math division said that the joystick must be turned off before plugging the switch in.
We got around this by turning on the robot and joystick while setting up, changing the autonomous via LCD, then turning off the joystick, (plugging the competition switch in, then turning it on). If we didn’t do this, any claims about connection would “weaken.”
My question is, how does everyone else change programs using the LCD? I tried placing the program decision logic in the pre_auton function (RobotC), but that did not do anything for me, as the “disabled mode” did not change the autonomous program.
Using EasyC, I programmed a routine for my team using a loop in Initialize. It will exit when either 5 seconds has passed (between autonomous and operator control) or the center button has been pressed (in the pre-match setup)
It then uses the global variable ‘auton’ to do a switch-case in Autonomous.
I do realize that the 5 second delay will have to be resolved for this year’s game, since there is no delay. Autonomous LCD.zip (3.2 KB)
I have used the LCD to switch programs as well, but it has worked fine for me when I put the code in the pre auton section. Could you post your code so we can see if that is the source of the problem?
I haven’t actually used the LCD to select programs (yet - I will this year :)), but I’ll throw my two cents in…
Are you using the competition switch to test the code in the pre-auton function, or are you using the one built-in to ROBOTC? I think the competition switch runs pre-auton as soon as the robot turns on, but the ROBOTC “disable” option ends the pre-auton function, too… I’ll have to test it, but that’s what my first guess would be.