I’m trying to use an lcd display in Robotc but whenever I turn the cortex on while its not connected to a computer it just displays “Robotc” (see attached). However, when I plug the cortex into a computer (as long as the computer is on and awake) it goes to what I actually want to display. I’m not sure why it is doing this.
Please post your code using the
tags for us to take a look at; also, which port do you have the LCD plugged into?
Thank you,
John
Sorry about that here is the code. I tried using uart 1 to start with but then tried it on 2 and got the same effect. I also noticed it works when a controller is plugged in instead of a computer.
#pragma config(Sensor, in1, currentraw, sensorNone)
#pragma config(Sensor, dgtl1, RPMRaw, sensorQuadEncoder)
#pragma config(Sensor, dgtl3, TestEncoder, sensorQuadEncoder)
#pragma config(Motor, port7, , tmotorServoContinuousRotation, openLoop)
#pragma config(Motor, port8, , tmotorVex269_MC29, openLoop)
#pragma config(Motor, port9, , tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
int MotorPower=0;
int Button=0;
int Time=0;
float RPM=0;
float RPM1=0;
task main()
{
clearLCDLine (0);
clearLCDLine (1);
clearTimer (T1);
clearAll(actOnSensors);
while (true)
{
Time=time1[T1];
Button=nLCDButtons;
displayLCDString(0,0,"Motor Power=");
displayLCDNumber(0,12,MotorPower);
displayLCDString(1,0,"RPM=");
displayLCDNumber(1,4,RPM);
if (Time>=1000)
{
RPM1= SensorValue[RPMRaw];
RPM=(abs((float)SensorValue [RPMRaw])/360)*60;
clearLCDLine (1);
clearAll(actOnSensors);
}
if (Time>=1000)
{
clearTimer (T1);
}
if (Button==4 && MotorPower<127)
{
MotorPower++;
motor [port9] = MotorPower;
wait1Msec (75);
if (MotorPower==-99)
{
clearLCDLine (0);
}
if (MotorPower==-9)
{
clearLCDLine (0);
}
if (MotorPower==0)
{
clearLCDLine (0);
}
}
if (Button==1 && MotorPower>-127)
{
MotorPower--;
motor [port9] = MotorPower;
wait1Msec (75);
if (MotorPower==99)
{
clearLCDLine (0);
}
if (MotorPower==9)
{
clearLCDLine (0);
}
}
if (Button==2)
{
clearLCDLine (0);
MotorPower=0;
motor [port9] = MotorPower;
}
}
}