Writing to LCD

  1. 4 months ago

    The kids are trying to update the LCD when running in driver control.

    They added the following lines, but it seems the LCD gets overwritten with other default string.

    What is the proper way to add TEXT to the LCD?

    task usercontrol()
    {
    clearLCDLine(0);
    clearLCDLine(1);
    displayLCDCenteredString(0,"Barcbots Speed Demons");
    displayLCDCenteredString(1,"11101A");

    //startTask(emergencyStopTask, 10);
    startTask(driveTask);

  2. DarkMatterMatt

    Oct 9 Auckland, New Zealand 2900C

    If you're using the competition template, you could have accidentally left default LCD code in.

    Have you removed the AutonomousCodePlaceholderForTesting(); and UserControlCodePlaceholderForTesting();?

  3. Yes, we removed those functions, still no luck.

  4. Manitha

    Oct 13 Brampton, Ontario 99000B
    Edited 4 months ago by Manitha

    Im not quite sure what's causing your text to be replaced. Im pretty its the comp code. Anyways the way i did it was i had a seperate task for the lcd and then started it in task main.

    Does the text you want ever appear on the lcd? Try and figure out when it disappears.

    Edit: forgot about display comp status.

  5. jpearman

    Oct 13 Moderator, ROBOTC Tech Support, V5 Beta Moderator Rockstar, Los Angeles 8888
    Edited 4 months ago by jpearman

    Here is the pre-auton function from recent (last year or so) versions of ROBOTC.

    /*---------------------------------------------------------------------------*/
    /*                          Pre-Autonomous Functions                         */
    /*                                                                           */
    /*  You may want to perform some actions before the competition starts.      */
    /*  Do them in the following function.  You must return from this function   */
    /*  or the autonomous and usercontrol tasks will not be started.  This       */
    /*  function is only called once after the cortex has been powered on and    */
    /*  not every time that the robot is disabled.                               */
    /*---------------------------------------------------------------------------*/
    
    void pre_auton()
    {
      // Set bStopTasksBetweenModes to false if you want to keep user created tasks
      // running between Autonomous and Driver controlled modes. You will need to
      // manage all user created tasks if set to false.
      bStopTasksBetweenModes = true;
    
      // Set bDisplayCompetitionStatusOnLcd to false if you don't want the LCD
      // used by the competition include file, for example, you might want
      // to display your team name on the LCD in this function.
      // bDisplayCompetitionStatusOnLcd = false;
    
      // All activities that occur before the competition starts
      // Example: clearing encoders, setting servo positions, ...
    }

    Notice the comments say

    	
      // Set bDisplayCompetitionStatusOnLcd to false if you don't want the LCD
      // used by the competition include file, for example, you might want
      // to display your team name on the LCD in this function.
      // bDisplayCompetitionStatusOnLcd = false;

    so uncomment this line so it shows like this.

    bDisplayCompetitionStatusOnLcd = false;

    startTask also used to cause the task name to be displayed, but I removed that about 18 months ago.

  6. dsivo

    Oct 14 Hopkinton MA 2602H

    If I were you, I would go back to the default template for some simple debug testing. For instance, this is what my team had last year and it seemed to work just fine. In addition, if you go to "Sample Programs" in RobotC, you can find an LCD program that works perfectly fine.

 

or Sign Up to reply!