0
votes

How can a long text be displayed in continuation on both lines of the LCD using Arduino?

I am trying to display serial data on the LCD using Arduino, but the sentence I input is getting truncated after the first line of LCD.

1
We can't help you if we don't know what LCD that you're using. this is a better site for this question: electronics.stackexchange.com and I'm guessing you haven't tried looking at the datasheet for the LCD, as that would most definitely have your answerOptox
give the kind of LCD you're using, what did code did you try to write so far, how many characters is your LCD..?zmo

1 Answers

2
votes

Basically, to use the most common LCDs, there is a library for Arduino:

And the example code is:

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // Here is the pinout of your LCD. Read the tutorial to understand what it means.

void setup() {
    // Set up the LCD's number of columns and rows:
    lcd.begin(16, 2);

    // Prints the first line which is 20 characters wide, padded with spaces, and the 'world!' will be on second line.
    lcd.print("hello,              world!");
}

void loop() {
    // Set the cursor to column 0, line 1 (note: line 1 is
    // the second row, since counting begins with 0):
    lcd.setCursor(0, 1);

    // Print the number of seconds since reset:
    lcd.print(millis()/1000);
}

Whatever you print on the LCD is considered as one line. So to print a text on both lines, you need to pad your first line with spaces, until the number of characters of the line is reached. Then all the text following will display on the second line.