/*
  LiquidCrystal Library - Test ASI
  Gebruikt als demo verschillede LCD stuff op een Arduino MEGA 2560
  
  The circuit:
  LCD VSS pin(1) to ground
  LCD VCC pin(2) to 5V
  LCD VO  pin(3) pot.meter set to 0.7V
  LCD RS  pin(4) to digital Arduino header pin 41
  LCD RW  pin(5) to digital Arduino header pin 40
  LCD EN  pin(6) to digital Arduino header pin 39
  
             LCD: DB0  to  DB7
         LCD pin: 7    to  14
  Arduino header: 49   to  42
       uC port L: 0    to  7

*/
// include the library code:
#include <LiquidCrystal.h>

#define LCDCharsPerLine 24
#define LCDLines        2
#define LCDLine_1       0
#define LCDLine_2       1


// Strings used in project
const PROGMEM char Mess_100a[]= "My test project";
const PROGMEM char Mess_100c[]= "abcd";
const PROGMEM char Mess_101a[]= "1234";
const PROGMEM char Mess_101b[]= "String 2";
const PROGMEM char Mess_101c[]= "String 3";

const String PROGMEM Mess_200a = String("My Test Projecttt");


// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(41, 40, 39, 49, 48, 47, 46, 45, 44, 43, 42);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(LCDCharsPerLine, LCDLines);

  IniMessage();
  


  //4 laatste char op lijn 0 = eerste 4 van lijn 1
  lcd.setCursor(20,LCDLine_1);
//  lcd.print("abcd");
  lcd.print(Mess_100c);
  
  //4 laatste char op lijn 1 = eerste 4 van lijn 2
  lcd.setCursor(20,LCDLine_2);
//  lcd.print("1234");
  lcd.print(Mess_101a);

  delay(500);
}

void IniMessage() {
  byte i;
  byte bytStart= (byte)(LCDCharsPerLine - strlen(Mess_100a)) / 2;

  lcd.setCursor(bytStart,0);
  lcd.print(strlen(Mess_100a));

  delay(1000);

  /*
  for (i = 0; i<strlen(Mess_100a);i++){
    lcd.setCursor(bytStart+i,LCDLine_1);
    //lcd.print(Mess_100a(i));
    lcd.print(Mess_100a);
    delay(100);
  }
  */
  
}


void loop() {
  // set the cursor to column 0, line 2
  // print the number of ms since reset:  
  lcd.setCursor(0,LCDLine_2);
  lcd.print(millis());
}

