LCD Screen Cutting Out

Hey everyone,

I’m currently having problems where my LCD screen constantly wants to reset after a few minutes of driving around. The problem with this is that if this happens during a match, I have to select my autonomous function before I can start driving again making me completely void during driver control. Here is my pre-auton control if anyone can spot any mistakes that may cause this issue:

Thanks for your help,
Soham 4001A

void pre_auton()
{
//Declare count variable to keep track of our choice

//------------- Beginning of User Interface Code ---------------
//Clear LCD
clearLCDLine(0);
clearLCDLine(1);
//Loop while center button is not pressed
while(nLCDButtons != centerButton)
{
	//Switch case that allows the user to choose from 4 different options
	switch(count){
	case 0:
		//Display first choice
		displayLCDCenteredString(0, "Red front");
		displayLCDCenteredString(1, "<         Enter        >");
		waitForPress();
		//Increment or decrement "count" based on button press
		if(nLCDButtons == leftButton)
		{
			waitForRelease();
			count = 3;
		}
		else if(nLCDButtons == rightButton)
		{
			waitForRelease();
			count++;
		}
		break;
	case 1:
		//Display second choice
		displayLCDCenteredString(0, "Red back");
		displayLCDCenteredString(1, "<         Enter        >");
		waitForPress();
		//Increment or decrement "count" based on button press
		if(nLCDButtons == leftButton)
		{
			waitForRelease();
			count--;
		}
		else if(nLCDButtons == rightButton)
		{
			waitForRelease();
			count++;
		}
		break;
	case 2:
		//Display third choice
		displayLCDCenteredString(0, "Blue Front");
		displayLCDCenteredString(1, "<         Enter        >");
		waitForPress();
		//Increment or decrement "count" based on button press
		if(nLCDButtons == leftButton)
		{
			waitForRelease();
			count--;
		}
		else if(nLCDButtons == rightButton)
		{
			waitForRelease();
			count++;
		}
		break;
	case 3:
		//Display fourth choice
		displayLCDCenteredString(0, "Blue back");
		displayLCDCenteredString(1, "<         Enter        >");
		waitForPress();
		//Increment or decrement "count" based on button press
		if(nLCDButtons == leftButton)
		{
			waitForRelease();
			count--;
		}
		else if(nLCDButtons == rightButton)
		{
			waitForRelease();
			count++;
		}
		break;
	case 4:
		//Display fourth choice
		displayLCDCenteredString(0, "Programming skills");
		displayLCDCenteredString(1, "<         Enter        >");
		waitForPress();
		//Increment or decrement "count" based on button press
		if(nLCDButtons == leftButton)
		{
			waitForRelease();
			count--;
		}
		else if(nLCDButtons == rightButton)
		{
			waitForRelease();
			count = 0;
		}
		break;
	default:
		count = 0;
		break;
	}
}

}

Change your while loop’s condition to include a competition mode check:


while(nLCDButtons != centerButton)

becomes


while(nLCDButtons != centerButton && !competition.isEnabled())

You don’t want to go into autonomous selection if the robot starts up in autonomous or driver control, and adding the check for not enabled will accomplish that. Be sure to plug your controller into field control before starting this program or this condition will make it skip over autonomous selection.