LCD Module Failure

So in our code, we have an LCD to Select Auto. We often lose connection
(Working on this) an find ourselves panicking because our robot is dead on the field because our LCD decided that we needed to Select an Auto. Again. Is there any way we can resolve this. i.e. putting a function in driver control or something?

Running RobotC v4.06
Selection is made in Pre-Auton
Autonomous Reads LCD Value
Driver Displays Voltage.

Thanks,

Please post your code.

I’m 99% sure that your selection/reading LCD input code should be in pre_auton(), not autonomous(). (But, then again, it’s been a while since I’ve written an LCD selector.)

Would it help to place a default selection in your pre-autonomous? The default could be to do nothing during autonomous, and I think that would prevent your code from hanging up while still waiting on the LCD when no LCD is connected.

Okay this means you have an infinite loop running that is never ended.

Put your code inside a task
task autonchooser(){
code
}
and in preauton say
StartTask(autonchooser);

This will allow the auton chooser to run while driving.
In the driver control put
StopTask(autonchooser);
This will conserve processing power.

/nitpick alert.

Not necessarily. It simply means there is (most likely) a loop running that has not met its exit condition.

An infinite loop refers to a loop that will never terminate under any valid input. For example:

while(1 < 2) {
   //doStuff
}

However, something like:

while(!SensorValue[btn1]) {
   //doStuff
}

… should not be considered an “infinite loop” when the only problem is that btn1 was never pressed.

Sorry for the nitpick, but just wanted to clear up “infinite loop” vs “exit condition not met.” :wink:

//Andrew

It seems like his code uses the exit condition of autonomous starting to terminate the loop. It wouldn’t run driver normally if this was not the case.

It appeared he had a loop that was infinite but used like competition control to end like most people do inside an operator control loop.

Look up the 4080A programming help needed thread and you will see where JPearman corrected that code so the lcd only looked for an input when the field controller was set to disabled. That robot had the same issue every match in San Antonio, and never again since. The code below is what was changed. If you post your code you should get some help fixing it.

#include "Vex_Competition_Includes.c"  //Main competition background code do not modify!


//Declare count variable to keep track of our choice
int count = 0;

//Wait for Press--------------------------------------------------
void waitForPress()
{
    while( (nLCDButtons == 0) && bIfiRobotDisabled )
        wait1Msec(5);
}
//----------------------------------------------------------------

//Wait for Release------------------------------------------------
void waitForRelease()
{
    while( (nLCDButtons != 0) && bIfiRobotDisabled )
        wait1Msec(5);
}


void pre_auton()