Go Down

Topic: What is the code for making a text flash on LCD screen? (Read 1 time) previous topic - next topic

apples

Playing with my LCD, what is the code for flashing some written text on the LCD screen?

UKHeliBob

Something like this maybe ?
Code: [Select]

#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

void setup()
{
  lcd.begin(16, 2);
}

void loop()
{
  lcd.print("Some text");
  delay(500);
  lcd.clear();
  delay(500);
}
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

apples

Ahh yeah, righto.  I just thought there might be a command line for it already.

Next ?

The text I have displayed now, (just mucking around playing connect 4 with the kids is)

   GAME SCORE
Peter      Nicholas
   0             1
     Game On

Want to make the GAME SCORE flash for example.

That line of code you gave me would make the text flash as long as I repeat it.

But I only want the first line, or 2nd line, or line 1 and line 4 to flash only. 

How would you do it then?

Can you have mini loop's going  ie void loop for line 1 of text?  Then normal then void loop for line 4 text?


Peter

UKHeliBob

Have a look at this for some ideas

Code: [Select]
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

void setup()
{
  lcd.begin(16, 2); 
  lcd.setCursor(0,0);
  lcd.print("line 1");
  lcd.setCursor(0,1);
  lcd.print("line 2");
}

void loop()
{
  for (int count=0; count <= 5; count++)
  {
    lcd.setCursor(0,0);
    lcd.print("      ");
    delay(500);
    lcd.setCursor(0,0);
    lcd.print("line 1");
    delay(500);
  }

  for (int count=0; count <= 5; count++)
  {
    lcd.setCursor(0,1);
    lcd.print("      ");
    delay(200);
    lcd.setCursor(0,1);
    lcd.print("line 2");
    delay(200);
  }
}


There are better ways to do it but you will get the general idea.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

mark7w

Try this.

Code: [Select]
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7,8,9,10,11,12);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("GAME SCORE");
}

void loop() {
  // Turn off the cursor:
  lcd.noDisplay();
  delay(250);// change for faster flash
   // Turn on the cursor:
  lcd.display();
  delay(250);// change for faster flash
}

Go Up