Simpler LCD Code Chooser?

Not sure where to post this - but I was wondering if anyone had a “simpler” code chooser (for the LCD screen) than what comes in the robotC sample code. I don’t want my kids to use any code that they don’t understand - and I am having trouble “understanding” the code myself (lots of “nots,” variable names instead of numbers, etc). Is there a more straightforward code available?

One of the first things I ever wrote was a code chooser, here is the code I used for that:

(A lot of that code never worked, but the LCD did)

Hope this helps

~Jack

I’m thinking OP is looking for something that looks a little simpler than the default code chooser (at least control flow wise). This library has an LCD-based menu system, but it isn’t simpler than Vex’s design from a programming perspective; however, I think it’s easier to use even if you don’t understand pointers. Here is an example code base using the aforementioned library. Lines 70-76 declare menus, lines 100-122 (excluding line 121) initialize these menus and link them together to form a tiered menu system, and line 123 waits for feedback from a menu before closing its scope (which happens to be pre_auton, thereby forcing the robot to wait in pre_auton until the driver’s command).

The simplest way for students to code their own program selection is to use jumpers. A jumper in a sensor port is like a pressed button, so code can be run based on jumper placement with simple if statements. A hand written list and jumpers in hand allows code selection at the field.

if (SensorValue[dgtl1] == 1)
{
// run this code when a jumper is in digital sensor port 1
}


//global variables, maybe not most elegant but simplest
bool redSide = true;  //default to red side autonomous if no button pressed
bool blueSide = false;

//remember to start task LCD in preauton
//in autonomous call "if(redSide) {...} else if(blueSide) {...}"
task LCD()
{
	while(true)  // An infinite loop to keep the program running until you terminate it
	{
		clearLCDLine(0);  // Clear line 1 (0) of the LCD
		clearLCDLine(1);  // Clear line 2 (1) of the LCD

		//auton selection
		if(nLCDButtons == leftButton) {
			redSide = true;
			blueSide = false;
			clearLCDLine(0);
			clearLCDLine(1);
			displayLCDString(0, 0, "Autonomous:");
			displayLCDString(1, 0, "Red side");
		}

		else if(nLCDButtons == rightButton) {
			redSide = false;
			blueSide = true;
			clearLCDLine(0);
			clearLCDLine(1);
			displayLCDString(0, 0, "Autonomous:");
			displayLCDString(1, 0, "Blue side");
		}

		//Short delay for the LCD refresh rate
		wait1Msec(100);
	}
}