BCD is a limited subset of a hex nibble (single hex character). You can do that using bit shifts:
Code:
uint8 temp = getDigitalIn(#);
temp |= (getDigitalIn(#)) << 1;
temp |= (getDigitalIn(#)) << 2;
temp |= (getDigitalIn(#)) << 3;
//Now temp is a number from 0x00 to 0x0F
The lower levels of the WPIlib access the Digital Inputs as a single uint16 from the FPGA. If you wanted to poke and find the function to read those, you could just apply a mask and bitshift to get your number, instead of creating 4 dio objects and reading all of them (much less code, more efficient):
Code:
uint16 auton_num = <get the 16 bit DI register>;
auton_num &= 0x00F0;
auton_num = auton_num >> 4;
In LV, we use the auton number to index a 2d array of auton types (a struct of an array of strings and a command number). The first index is the auton, the second is time (when the command returns True, it advances to the next element in the array on the next iteration). The array is populated on boot by reading text files and parsing them. The array of strings are arguments, which functions read numbers out of on the first call.