Q.No.10 - WAP to display scrolling text "NIELIT HQ" on LCD from left to right and then right to left.

Sol.-

#include <LiquidCrystal.h>
LiquidCrystal lcd(2,3,4,5,6,7);
int i=0 ;  //i is set for row
int j;     // j is used for columns value and set it according to word lenght.
void setup()
{
  lcd.begin(16,2);
}
void loop()
{
  for(j=-9;j<=16; j++)
  {
    lcd.setCursor(j,i);
    lcd.print("NIELIT HQ");
    delay(100);
    lcd.clear();
  }
  for(j=16;j>=-9;j--)
  {
    lcd.setCursor(j,i);
    lcd.print("NIELIT HQ");
    delay(100);
    lcd.clear(); 
  }
}

Pins connections:- For LCD LED- connected to ground having resistor 1kilo ohm. LED- connnected to ground. DB7- to Digital pin 7 DB6- to pin no. 6 DB5- to pin no. 5 DB4- to pin no. 4 E(Enable)- to pin no. 3 R/W (read/write)- ground connection RS - pin no. 2 V0 - ground with resistor 330 ohm VCC- power 5v Gnd- ground.

OUTPUT: