I'm learning Arduino and this one issue is has me stumped. I'm trying to have it show an greeting message then clear and show another message. I can't figure out what else I need to add to do that.
Here is my code:
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 4, d5 = 5, d6 = 6, d7 = 7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
lcd.begin(16, 2);
}
void loop() {
lcd.setCursor(2,0);
lcd.print("Good Evening");
lcd.setCursor(5,1);
lcd.print("Master");
delay(2000);
lcd.clear();
delay(1000);
lcd.setCursor(1,0);
lcd.print("Please enter");
lcd.setCursor(3,1);
lcd.print("your password: ");
}
Welcome to the forum
Your topic was MOVED to its current forum category as it is more suitable than the original
captscott42:
Here is my code:
Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'
Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination
See also FAQ - Arduino Forum for general rules on forum behaviour and etiquette.
Hello,
Welcome to the Arduino Forum.
This guide explains how to get the best out of this forum. Please read and follow the instructions below.
Being new here you might think this is having rules for the sake of rules, but that is not the case. If you don’t follow the guidelines all that happens is there is a long exchange of posts while we try to get you to tell us what we need in order to help you, which is fru…
IF that is all you need, then put ALL that code in the setup() function and it will be done only once.
gcjr
June 25, 2022, 4:52pm
4
does any text appear on the display?
Power on should display a row of blocks. if you can't see that, adjust the contrast pot on the I2C board. If you don't HAVE an I2C board GET ONE.
You can edit your original post to include tags by using the little pencil
The problem is that you have the code in loop...
void loop()
{
// Display first message
// delay for 2 seconds
// clear the screen
// delay for 1 second
// Display second message
}
So immediately after displaying the second message, the loop begins again... and the first thing it does is display the first message again... overwriting the second message almost immediately, so you never see it.
Add another delay(2000) after the second message and you will be able to see more clearly what is happening.
Mark your post as solved and learn about code tags and the edit pencil
system
Closed
December 27, 2022, 11:47pm
10
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.