Pages: [1]   Go Down
Author Topic: What is the code for making a text flash on LCD screen?  (Read 936 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 89
Posts: 3458
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Something like this maybe ?
Code:
#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);
}
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 89
Posts: 3458
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have a look at this for some ideas

Code:
#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.
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

London-UK
Offline Offline
Full Member
***
Karma: 1
Posts: 106
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try this.

Code:
#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
}
Logged

Pages: [1]   Go Up
Jump to: