LCD 20 x 4 help?

I have 20 x 4 LCD and my coding is this for 20 x 2 LCD

#include <LCD4Bit.h>

//create object to control an LCD.
//number of lines in display=2
LCD4Bit lcd = LCD4Bit(2);

void setup() {

pinMode(13, OUTPUT); //we’ll use the debug LED to output a heartbeat
lcd.init();

}

void loop() {

lcd.clear(); // Clear display

lcd.printIn(“UBAID”); // Dislay text on first line

lcd.cursorTo(2,0); // Move cursor to second line, position 0

lcd.printIn(“KHAN”); // Display text on second line

while(1) // Endless loop flashing the LED
{
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
}

But I don’t get how to modify it for 20 x 4. Please help me for this.

Hey,

All you have to do is print to the third or fourth line on the LCD.

 lcd.clear();                      // Clear display

 lcd.printIn("UBAID");    // Dislay text on first line

 lcd.cursorTo(2,0);                // Move cursor to second line, position 0

 lcd.printIn("KHAN");  // Display text on second line

So first they clear the screen so it's not displaying prior text lcd.clear();

Then the first thing they do is print UBAID on the first line, since after clearing the screen the cursor starts at 0,0 (first line, 0th character)

Then they advance the cursor to the second line: lcd.cursorTo(2,0); // Move cursor to second line, position 0 and then print KHAN

So what you have to do is move the cursor to the 3rd or 4th lines, so: lcd.cursorTo(3,0); // Move cursor to third line, position 0

And print whatever you want: lcd.printIn("Waterppk Rocks"); // Display text on third line

Chris

thank you Waterppk