Good morning.
I just get a LCD with 16 col and 4 ligns
I would like to use it to display the Welcome text and all Serial input and all Serial.print().
I am woriking with Arduino Uno.
I imported the library
#include <LiquidCrystal.h>
First issue:
and at the setup() I enter this
lcd.begin(16, 4);
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 0);
// Print a message to the LCD.
lcd.print("****************"); // Display 16x* at the first lign
lcd.print("*** Wellcome ***"); // Display those 16 caracter at the lign 2
lcd.print("*** to iBip ****"); // Display those 16 catacters at the lign 3
lcd.print("***************"); // Display those 16 starts at the last lign
delay(5000);
lcd.clear(); // Clear the screen
As there is 16 col, I suppose the nect caracter will go to the second lign, but it does not goe to the 3 lign.
Then I tried to use
lcd.setCursor(0, 1);
lcd.print("*** Wellcome ***"); // Display those 16 caracter at the lign 2
lcd.setCursor(0, 2);
lcd.print("*** to iBip ****"); // Display those 16 catacters at the lign 3
lcd.setCursor(0, 1);
lcd.print("***************"); // Display those 16 starts at the last lign
But it work only for the 2nd lign. The third lign is displayed form the 7col......
Second problemI want to diaplay the Serial input. I have that function which display in Terminal
String getMessage() {
String s="";
while(1) {
if(cell.available()>0) {
s = s+(char)cell.read();
if (s.length()>1 && s[s.length()-2]=='\r' && s[s.length()-1]=='\n') { // if last 2 chars are \r\n
if (s==" \r\n" || s=="\r\n") { // skip these, move on
s="";
}
else { // we have a message!
#ifdef DEBUG
Serial.println(s.substring(0,s.length()-2));
#endif
lcd.print(s.substring(0,s.length()-2));
return s.substring(0,s.length()-2);
}
}
}
}
}
It works but I want to have each new message in a new lign.
Third problemWhen my display is full. When all lign are showing a message. I would to have the
- The Second lign displayed at the lign 1
- The third lign display at lign 2
- The last lign displaed at lign 3
- The new message at lign 4.
How can I do it??
I check autoscroll, but auto scroll display the carater after the last and not a a new lign.
In fact, I would like to have exactely what does the terminal, but in a LCD.
Could you help me for my first LCD task??
Do you know some tutorials
Many thank