#pragma config(UART_Usage, UART1, uartVEXLCD, baudRate19200, IOPins, None, None) #pragma config(UART_Usage, UART2, uartNotUsed, baudRate4800, IOPins, None, None) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// typedef enum { noButton = 0, leftButton = 1, centerButton = 2, rightButton = 4 } sLCDButtons; typedef enum { left = -1, right = 1, nullPosition = 0, } pAlignments; typedef enum { blue = -1, red = 1, nullColor = 0 } pAllianceColors; #define numberOfRoutines 5 void LCDWaitForRelease () { while(nLCDButtons != noButton) wait1Msec(100); } //The enterLCDButton function will look for and wait for a button to be pressed, and returns that button's name sLCDButtons enterLCDButton ( bool useLeft, bool useCenter, bool useRight, int timeoutSec = 10) { ClearTimer(T1); bool quit = false; sLCDButtons returnButton = noButton; while(!quit) { if(useLeft && nLCDButtons == leftButton) { quit = true; LCDWaitForRelease(); returnButton = leftButton; } else if(useCenter && nLCDButtons == centerButton) { quit = true; LCDWaitForRelease(); returnButton = centerButton; } else if(useRight && nLCDButtons == rightButton) { quit = true; LCDWaitForRelease(); returnButton = rightButton; } else if(time1[T1] > (timeoutSec * 1000)) { quit = true; returnButton = noButton; } } return returnButton; } void displayLCDAlignedString(int nLine, pAlignments align, const string textToDisplay) { int rightPosition = 16-strlen(textToDisplay); writeDebugStreamLine("%i", rightPosition); switch(align) { case left: displayLCDString(nLine,0,textToDisplay); break; case right: displayLCDString(nLine,rightPosition, textToDisplay); break; } }