We just got two new LCDs in the mail today. Although I’m familiar with how to connect the LCD to the Cortex and how to use the display, the CMU video trainer is silent on how to use the LCD buttons. What is the code for that?
To accès the LCD buttons, use the nLCDButtons system variable. Here is an example.
// Wait for LCD button release
void
waitForLcdButtonRelease()
{
while( nLCDButtons != kButtonNone )
wait1Msec(5);
}
task main()
{
bLCDBacklight = true;
displayLCDString(0, 0, "Press a button ");
while(1)
{
if( nLCDButtons == kButtonLeft ) {
displayLCDString(0, 0, "LCD left ");
waitForLcdButtonRelease();
}
if( nLCDButtons == kButtonCenter ) {
displayLCDString(0, 0, "LCD center ");
waitForLcdButtonRelease();
}
if( nLCDButtons == kButtonRight ) {
displayLCDString(0, 0, "LCD right ");
waitForLcdButtonRelease();
}
// Always use wait in main while loop
wait1Msec(10);
}
}