Go Down

Topic: Displaying on LCD (Read 1 time) previous topic - next topic

Daniel Formosa

Dear all,
I am trying to display some information on the LCD, such as

Choose setup
Press A for
entering amount
....

I have used the following code:

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);    //rs,rw,enable,d4,d5,d6,d7

void setup()
{
  Serial.begin(9600);   
 
 
}
void loop()
{
   Display();
 
}

void Display()
{
  lcd.begin(16,2);                        //initialise lcd
  lcd.noCursor();
  lcd.print("Choose Setup");              //display on lcd
  //delay(100);
// lcd.clear();
  lcd.print("Press A for ");
  //delay(100);
  //lcd.print("entering amount");
  //lcd.print("needed by keypad");
}


And when inserting the delay it doesnt show coorrect

What am I doing wrong?
Thank you






pwillard

#1
Feb 02, 2011, 01:25 pm Last Edit: Feb 02, 2011, 01:27 pm by pwillard Reason: 1
Please use the CODE button  "#' when posting code.

Code: [Select]

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);    //rs,rw,enable,d4,d5,d6,d7

void setup()
{
 Serial.begin(9600);  
  lcd.begin(16,2);                        //initialise lcd
  lcd.noCursor();

}
void loop()
{
  Display();

}

void Display()
{

 lcd.print("Choose Setup");              //display on lcd
 //delay(100);
// lcd.clear();
 lcd.print("Press A for ");
 //delay(100);
 //lcd.print("entering amount");
 //lcd.print("needed by keypad");
}


I will start by saying you are constantly initializing your display... which only needs to happen once... in the setup() block

So, put these lines below in setup(), since constantly initializing the display in the loop() block adds unnecessary delay and confusion to your current problems...
Quote

lcd.begin(16,2);                        //initialise lcd
lcd.noCursor();

Daniel Formosa

Ok I did wat you said, but now the LCD just keeps displaying the sentences together and dont stop.
This is my arranged code


#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);    //rs,rw,enable,d4,d5,d6,d7

void setup()
{
  Serial.begin(9600);   
  lcd.begin(16,2);
//  lcd.noCursor();
 
 
}
void loop()
{
   Display();
 
}

void Display()
{
 
  lcd.print("Choose Setup");              //display on lcd
  //delay(100);
// lcd.clear();
  lcd.print("Press A for ");
  delay(100);
  //lcd.print("entering amount");
  //lcd.print("needed by keypad");
}

Daniel Formosa

Took care of everything.

Am new to arduino thats y had a lot of wrong things.

Thank you

Go Up