Skip to content

Controlling the LCD

Jeffrey Shen edited this page Jul 24, 2017 · 3 revisions

The LCD enables a robot to display sensor data, battery levels, funny messages, etc. as well as have various different autonomous modes to cycle between.

The LCD functionality provided by this library enables the user to display a message during user control and cycle between autonomous modes during pre autonomous.

Usage

Your LCD must first be plugged into UART2 on the cortex in order for the following code to work. In config.c: #define USE_LCD 1
You also need to provide a method void lcdGenerateMessage() that sets the variables lcdStr1 and lcdStr2 to the values that you want to be displayed. For example:

void lcdGenerateMessage(){
  sprintf(lcdStr1, "8900 %4.1fV %4.1fV", getMainBatteryVoltage() / 1000.0, getSecondBatteryVoltage() / 1000.0);
  sprintf(lcdStr2, "Parallax");
}

Now, in pre autonomous you will be able to cycle between autoA, autoB, autoC, and prgSkills modes (see how to program autonomous modes here) and in user control the message defined by lcdGenerateMessage() will be displayed.