Blinking Cursor Off with Sparkfun LCD

Hello,

I am using this LCD display with Software Serial library.

I finally got the blinking cursor to work but I can’t turn it off! Running the program bricks that position and cursor doesn’t stop blinking. I am using the command from the datasheet (0x0C), not sure what I am doing wrong.

Thanks

void loop()

{
  mySerial.write(254);
  mySerial.write(192);
  mySerial.write("*=Clear #=Enter ");
  mySerial.write(254);
  mySerial.write(0x0D);
  delay(1000);
  mySerial.write(0x14);
  delay(1000);
  mySerial.write(0x14);
  delay(1000);
  mySerial.write(0x14);
  delay(1000);
  mySerial.write(0x14);
  delay(1000);
  mySerial.write(0x14);
  mySerial.write(0x0C);
  
  while(1);
}

If you go back and document the magic numbers it will make it easier for others to troubleshoot your code.

Example:

mySerial.write(254);  // (explain what 254 represents)

Don

Okay, with notes.

void loop()

{
  mySerial.write(254); //move cursor to first line
  mySerial.write(192); //move cursor to 1st line bottom row
  mySerial.write("*=Clear #=Enter "); //prints message along bottom row
  mySerial.write(254); //move cursor to first line
  mySerial.write(0x0D); //blinking cursor on
  delay(1000);              //wait 1s
  mySerial.write(0x14); //move cursor to the right on position
  delay(1000);            
  mySerial.write(0x14); 
  delay(1000);
  mySerial.write(0x14);
  delay(1000);
  mySerial.write(0x14);
  delay(1000);
  mySerial.write(0x14);
  mySerial.write(0x0C); //turn blinking cursor off
  
  while(1);
}

I think that Don was looking for this:

void loop()
{
    mySerial.write(254);     //command byte follows
    mySerial.write(192);     //gotoXY( 0, 1)
    mySerial.write("*=Clear #=Enter ");
    mySerial.write(254);    
    mySerial.write(0x0D);    //Blinking box cursor on
    delay(1000);
    mySerial.write(254);     //command byte follows
    mySerial.write(0x14);    //Move cursor right one
    delay(1000);
    mySerial.write(254);     //command byte follows
    mySerial.write(0x14);
    delay(1000);
    mySerial.write(254);     //command byte follows
    mySerial.write(0x14);
    delay(1000);
    mySerial.write(254);     //command byte follows
    mySerial.write(0x14);
    delay(1000);
    mySerial.write(254);     //command byte follows
    mySerial.write(0x14);
    mySerial.write(254);     //command byte follows
    mySerial.write(0x0C);    //Turn visual display oon

    while (1);
}

Personally, I find it rather longwinded. You could do the escape sequence with a literal string e.g.

    mySerial.write("\254\x0D");    //Blinking box cursor on
    mySerial.write("\xFE\x0C");    //Turn visual display on
    mySerial.write("\254\12");    //Turn visual display on

Yes, the escape looks like gobbledygook. But at least it is a single statement with a single explanation.

And I would choose a single style for the character expressions. i.e. only use hexadecimal

David.