16x2 LCD not displaying on second line

Hi, i have this issue with an lcd that i have.
i hooked it up to my Arduino Uno and i used the liquidcrystal library. Now, here's the issue... when i use the print command, and i type above 16 characters, the characters disappear off the lcd. But, whats unusual is that on the 41st character, the text appears again. Very unusual...

here is the code...

#include <LiquidCrystal.h>

LiquidCrystal lcd( 12, 11, 5, 4, 3, 2);

void setup()
{

lcd.begin(16, 2);
lcd.clear();
}

void loop()
{
lcd.print("11111111111111111111111111111111111111111");
delay(20000);
lcd.clear();
}

But, whats unusual is that on the 41st character, the text appears again. Very unusual...

It may be unusual but that is the way they work. For a complete explanation follow the LCD Addressing link at Don's Collected Technical Information.

To use both lines of the display try something like this:

#include <LiquidCrystal.h>

//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);      // put your pin numbers here

void setup()
  {
  lcd.begin(16, 2);                          // put your LCD parameters here
  lcd.print("hello, world!");
  lcd.setCursor(0,1);
  lcd.print("it works!");
  }

void loop()
  {
                                             // do nothing in 'loop'
  }

Oh wow thanks, this is great and it works!, can you please explain to me how, im new to arduino and the coding especially... from my knowledge, i believe it works because you set the cursor? correct me if im wrong... but thanks!

... i believe it works because you set the cursor ...

Yes. The cursor is initially at (0, 0). It is automatically moved to the next position after you write each character.

You must re-position the cursor whenever you don't want it to follow this sequence.

The catch, explained at the link in my first answer, is that the second row of characters does not immediately follow the end of the first row of characters on most displays.

Don