Hey guys, I'm having some difficulty programming an LCD display. We don't have any jumper clips too. Can anyone help me program the LCD to display potentiometer values and choose programs?
I am assuming you mean the LCD for the edr cortex and you want to select autonomous and display potentiometer values in RobotC. To display a sensor value i would use the following
clearLCDLine(0); //Clear line 1 (0) of the LCD
clearLCDLine(1); //Clear line 2 (1) of the LCD
int value = SensorValue[arm]; //stores sensor value of your potentiometer to value
displayLCDString(0, 0,"Arm: "); //display a name of your potentiometer i.e. "Arm"
displayNextLCDNumber(value); //Display the potentiometer value
The code above displays a sensor value starting on the top line "0" and on the far left in box "0". You can also see all sensor values and variables in the debug tab of robotC, personaly this is what I would use unless you always need to see your potentiometer value.
As for selecting programs this is a bit more complicated, there are many forum threads that can explain this better than I can but I will try. I attached a program I found here on the forum years ago and slowly changed it to what it is today. It is setup as an include file, meaning all of the code is in its own separate file and if placed in the same folder as your code can be included with the code
#include "LCD Autonomous Selector.c" The file creates a task that can be called in your user control code that selects a program. I call the task when 2 buttons are pressed using following code
if(vexRT[Btn8R]==1 && vexRT[Btn7L]==1)
waitUntil(vexRT[Btn8R]!=1 && vexRT[Btn7L]!=1); //wait for button unpress
startTask(Autonomous_Selector); //start task auton selector
This starts the task and allows you to select a program on the LCD. The result of the task stores the program you want to run as a integer with a value 1-4, to use this value my autonomous looks like this
clearLCDLine(0); // Clear line 1 (0) of the LCD
clearLCDLine(1); // Clear line 2 (1) of the LCD
//runs selected program
case 1: //Put first program here
break; case 2: //Put second program here
break; case 3: //Put third program here
break; case 4: //Put fourth program here
default://no auton selected
//put code here
I hope this helped a little, if you take a look in the attached files the code should be commented well enough to help explain what it does