Hi.
It's very simple, each button has a set value, and you can check the sum to see which are being pushed. 2 states (0 or 1) for 3 buttons = 2^3 = 8 possible combinations.
The LCD Buttons have values in powers of 2.
kLeftButton returns 1 (2^0)
kCenterButton returns 2 (2^1)
kRightButton returns 4 (2^2)
nLCDButtons returns the sum of the buttons when called. So it has these possible values 0 (none pushed) through 7 (all pushed).
here is a quick example, you can do more complex stuff with bit shifts and stuff, but this should show you the basic commands and how to use them. Download and run the code, and push the buttons and try to get the values 0 through 7 to show up. I hope it helps.
 |  |  |
 | Code: #pragma config(UART_Usage, UART2, VEX_2x16_LCD) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
/**************************/ /* Possible combinations: */ /* */ /* Binary Decimal Btn */ /**************************/ /* 000 0 --- */ /* 001 1 L-- */ /* 010 2 -C- */ /* 011 3 LC- */ /* 100 4 --R */ /* 101 5 L-R */ /* 110 6 -CR */ /* 111 7 LCR */ /**************************/
task main() { while(true) { // Clear LCD Lines clearLCDLine(0); clearLCDLine(1); // Top LCD Line Display Stuff: displayLCDPos(0,0); displayNextLCDString("nLCDButtons = "); displayNextLCDNumber(nLCDButtons); // 'nLCDButtons' is the SUM of the LCD button values. // Bottom LCD Line Display Stuff: displayLCDPos(1,0); displayNextLCDChar('L'); displayLCDPos(1,2); displayNextLCDNumber(kLeftButton); // 'kLeftButton' is worth decimal 1, binary 00000001, or 2^0. displayLCDPos(1,6); displayNextLCDChar('C'); displayLCDPos(1,8); displayNextLCDNumber(kCenterButton); // 'kCenterButton' is worth decimal 2, binary 00000010, or 2^1. displayLCDPos(1,13); displayNextLCDChar('R'); displayLCDPos(1,15); displayNextLCDNumber(kRightButton); // 'kRightButton' is worth decimal 4, binary 00000100, or 2^2. // Wait a little to keep the screen refreshing smoothly: wait1Msec(250); } } |  |
 |  |  |