lcd message

How I can print a message on the LCD with a 5V input ?

i want that when a 5v signal arrive to a arduino display a menssage at the lcd

is an arduino uno and a lcd 16x2

Is this a 0-5 volt analog input or 0-5 volt digital input?
Have got anything to print on the LCD from other sketches?

@fer101255 - Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

Your other post deleted.

  • Moderator

Are digital inputs.
I just want that arduino get a signal to print a message on the LCD.

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int buttonPin = 2;
int buttonState = 0;

void setup(){
pinMode(buttonPin, INPUT);
lcd.begin(16, 2);
lcd.print(“first message”);
delay(5000);
lcd.clear();
}

void loop() {
lcd.print(“second message”);
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
lcd.print(“button message”);
}
}

something like that

Something like that should work.
Are you able to see lcd output?

What part of the code does work, and what part does not work?

First problem is that the loop will cycle incredibly fast and update the LCD so often that it will likely be garbled as well as flickering.

Also, you are not setting the cursor position before you go to print the new messages.

Now, read the instructions, go back and modify your posting to mark up the code in a code box.

Oh, and do please verify that the first message is actually printed when you comment out all the “loop()” code - that you have set up the LCD correctly to start with?

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int buttonPin = 2;
int buttonState = 0;

void setup(){
  pinMode(buttonPin, INPUT);
  lcd.begin(16, 2);
  lcd.print("first message");
  delay(5000);
  //  lcd.clear();
}

void loop() {
/*  buttonState = digitalRead(buttonPin);
  if (buttonState == HIGH) {
    lcd.setcursor(0,0);
    lcd.print("button message");
  } 
  else {
    lcd.setcursor(0,0);
    lcd.print("second message");
  }
  delay(500);
*/ }

Thank you Paul__B
The code works good.
Thanks for help me.