My team made a function (it's part of our framework) to make an interface for that dsLCD that behaves essentially exactly like printf.
Code:
/**
* Send text to DS LCD display
*/
int DriverStationDisplay(const char* format, ...)
{
va_list args;
static string dash_string[6];
static bool init=true;
char formatted_string[DASHBOARD_BUFFER_MAX];
if(init) {
//Initializes it first call.
for(int i=0;i<6;i++) {
dash_string[i] = " ";
}
init=false;
}
va_start( args, format );
vsnprintf(formatted_string, DASHBOARD_BUFFER_MAX, format, args);
va_end(args);
//Move lines up to make room for the newline
for(int i=5; i>=1; i--) {
dash_string[i] = dash_string[i-1];
}
dash_string[0] = formatted_string;
for(int i=0; i<6; i++) {
dsHandleLCD->PrintfLine((DriverStationLCD::Line)i, dash_string[i].c_str());
}
dsHandleLCD->UpdateLCD();
return 0;
}
Feel free to use it, or even the whole framework, from
http://framework.chopshop166.com/
And you're welcome for the launcher, Ben wrote it really quickly, but it's small and works very well!