#include <LiquidCrystal.h>

const int rs = 5, en = 6, d4 = 4, d5 = 3, d6 = 2, d7 = 7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() 
{
  lcd.begin(8, 2);
  //  lcd.begin(16, 1);
}

void loop() 
{
  //              0123456789012345
  splitPrint( 0, "A Full Line Text");
  delay( 2000);
  splitPrint( 0, "ABCDEFGHIJKLMNOP");
  delay( 2000);
  splitPrint( 0, "This line of text is too long.");
  delay( 2000);
}

// Print a line of text.
// The 'column' is where the text starts on the LCD display
// Warning: The code is easy, but the result is slow
void splitPrint( int column, char *text)
{
  for( int i=0; i<strlen(text); i++)
  {
    int col = column + i;

    if( col < 8)
    {
      lcd.setCursor( i, 0);         // column, row
      lcd.print( text[i]);
    }
    else if( col < 16)
    {
      lcd.setCursor( i-8, 1);       // column, row
      lcd.print( text[i]);
    }
  }
}