Possible Case/Break problems, need help.

So I’m in a bit of a dilemma, I can’t seem to understand why my user control select function for my LCD won’t work. Every time I try to select anything, it switches to “Single control” in the usercontrol phase regardless; although, through testing my auton select is functioning. Please help I’m pretty sure I’m going crazy. Code in the link.


task singleController()
{
	while(true)
	{
		motor[LL] = vexRT[Ch2];
		motor[RL] = vexRT[Ch2];
		motor[D1] = (vexRT[Ch3] + vexRT[Ch4])/2;
		motor[D2] = (vexRT[Ch3] - vexRT[Ch4])/2;
	}
	if(vexRT[Btn6U]==1)
	{
		motor[SK]=127;
	}
	else(motor[SK]=0);
	if(vexRT[Btn6D]==1)
	{
		motor[SK]=-127;
	}
	else(motor[SK]=0);
}
////////////////////////////////////////////////////////////////////////////////////
task doubleController()
{
	while(true)
	{
		motor[D1] = vexRT[Ch3];
		motor[D2] = vexRT[Ch2];
		motor[LL] = vexRT[Ch2Xmtr2];
		motor[RL] = vexRT[Ch2Xmtr2];
	}
	if(vexRT[Btn6U]==1)
	{
		motor[SK]=127;
	}
	else(motor[SK]=0);
	if(vexRT[Btn6D]==1)
	{
		motor[SK]=-127;
	}
	else(motor[SK]=0);
}
////////////////////////////////////////////////////////////////////////////////////
const short leftButton = 1;
const short centerButton = 2;
const short rightButton = 4;
int count = 0;
int driver = 0;
////////////////////////////////////////////////////////////////////////////////////
void waitForPress()
{
	while(nLCDButtons == 0){}
	wait1Msec(5);
}
////////////////////////////////////////////////////////////////////////////////////
void waitForRelease()
{
	while(nLCDButtons != 0){}
	wait1Msec(5);
}
////////////////////////////////////////////////////////////////////////////////////
void pre_auton()
{
	clearLCDLine(0);
	clearLCDLine(1);
	while(nLCDButtons != centerButton)
	{
		bLCDBacklight = true;
		switch(driver)
		{
		case 0:
			displayLCDCenteredString(0, "Single control");
			displayLCDCenteredString(1, "<		 Enter		>");
			waitForPress();
			if(nLCDButtons == leftButton)
			{
				waitForRelease();
				driver = 1;
			}
			else if(nLCDButtons == rightButton)
			{
				waitForRelease();
				driver++;
			}
			break;
		case 1:
			displayLCDCenteredString(0, "Double control");
			displayLCDCenteredString(1, "<		 Enter		>");
			waitForPress();
			if(nLCDButtons == leftButton)
			{
				waitForRelease();
				driver--;
			}
			else if(nLCDButtons == rightButton)
			{
				waitForRelease();
				driver++;
			}
		default:
			driver = 0;
		}
	}
	////////////////////////////////////////////////////////////////////////////////////
	clearLCDLine(0);
	clearLCDLine(1);
	displayLCDCenteredString(0, "Initializing...");
	displayLCDCenteredString(1, "One moment...");
	wait(3);
	////////////////////////////////////////////////////////////////////////////////////
	while(nLCDButtons != centerButton)
	{
		switch(count)
		{
		case 0:
			displayLCDCenteredString(0, "Autonomous 1");
			displayLCDCenteredString(1, "<		 Enter		>");
			waitForPress();
			if(nLCDButtons == leftButton)
			{
				waitForRelease();
				count = 4;
			}
			else if(nLCDButtons == rightButton)
			{
				waitForRelease();
				count++;
			}
			break;
		case 1:
			displayLCDCenteredString(0, "Autonomous 2");
			displayLCDCenteredString(1, "<		 Enter		>");
			waitForPress();
			if(nLCDButtons == leftButton)
			{
				waitForRelease();
				count--;
			}
			else if(nLCDButtons == rightButton)
			{
				waitForRelease();
				count++;
			}
			break;
		case 2:
			displayLCDCenteredString(0, "Autonomous 3");
			displayLCDCenteredString(1, "<		 Enter		>");
			waitForPress();
			if(nLCDButtons == leftButton)
			{
				waitForRelease();
				count--;
			}
			else if(nLCDButtons == rightButton)
			{
				waitForRelease();
				count++;
			}
			break;
		case 3:
			displayLCDCenteredString(0, "Autonomous 4");
			displayLCDCenteredString(1, "<		 Enter		>");
			waitForPress();
			if(nLCDButtons == leftButton)
			{
				waitForRelease();
				count--;
			}
			else if(nLCDButtons == rightButton)
			{
				waitForRelease();
				count = 0;
			}
			break;
		case 4:
			displayLCDCenteredString(0, "P Skillz Yo");
			displayLCDCenteredString(1, "<		 Enter		>");
			waitForPress();
			if(nLCDButtons == leftButton)
			{
				waitForRelease();
				count--;
			}
			else if(nLCDButtons == rightButton)
			{
				waitForRelease();
				count = 0;
			}
			break;
		default:
			count = 0;
			break;
		}
	}
}
////////////////////////////////////////////////////////////////////////////////////
task autonomous()
{
	clearLCDLine(0);
	clearLCDLine(1);
	switch(count)
	{
	case 0:
		displayLCDCenteredString(0, "Autonomous 1");
		displayLCDCenteredString(1, "is running!");
		wait1Msec(250);
		{
			setMultipleMotors(127, D1, D2);
		}
		break;
	case 1:
		displayLCDCenteredString(0, "Autonomous 2");
		displayLCDCenteredString(1, "is running!");
		wait1Msec(250);
		{
			setMultipleMotors(-127, D1, D2);
		}
		break;
	case 2:
		displayLCDCenteredString(0, "Autonomous 3");
		displayLCDCenteredString(1, "is running!");
		wait1Msec(250);
		{
			setMultipleMotors(127, LL, RL);
			waitUntil(SensorValue[P1]==180);
		}
		break;
	case 3:
		displayLCDCenteredString(0, "Autonomous 4");
		displayLCDCenteredString(1, "is running!");
		wait1Msec(250);
		{
			setMultipleMotors(-127, LL, RL);
			waitUntil(SensorValue[P1]==0);
		}
		break;
	case 4:
		displayLCDCenteredString(0, "Skillz");
		displayLCDCenteredString(1, "are runnin dawg");
		wait1Msec(250);
		{
			////////////////////////////////////////////////////////////////////////////////////
		}
		break;
	default:
		displayLCDCenteredString(0, "No valid choice");
		displayLCDCenteredString(1, "was made!");
		break;
	}
}
////////////////////////////////////////////////////////////////////////////////////
task usercontrol()
{
	clearLCDLine(0);
	clearLCDLine(1);
	switch(driver)
	{
	case 0:
		displayLCDCenteredString(0, "Single");
		displayLCDCenteredString(1, "Is Running");
		{
			startTask(singleController);
			wait(3);
			{
				startTask(LCD);
			}
		}
		break;
	case 1:
		displayLCDCenteredString(0, "Double");
		displayLCDCenteredString(1, "Is Running");
		{
			startTask(doubleController);
			wait(3);
			{
				startTask(LCD);
			}
		}
		break;
	default:
		displayLCDCenteredString(0, "I Guess it's");
		displayLCDCenteredString(1, "Single then!");
		{
			startTask(singleController);
			wait(3);
			{
				startTask(LCD);
			}
		}
		break;
	}
}

you are missing a “break” in the initial switch statement so you fall through to the “default” condition and set driver as 0 again. The singleController and doubleController tasks also have issues, put the if statements inside the while loops.

How would this be set up? Once again I’m sorry for the lack of knowledge, I just started with LCD functions and such.

Wait, just found it, lol.

Your tasks are also problematic. Notice how the if statements for the buttons are not in the while loop.
Also,


else(motor[sk]=0);

should be


else { 
motor[sk] = 0; 
}