“Hello World” – the first program for every programmer. Today we will see how to make a “Hello World” program and show them on 1602A (16*2) & J204A (20*4) display.

Components:


  1. Arduino LCD (16*2 / 20*4 display)
  2. Arduino UNO
  3. Potentiometer / Variable resistor
  4. Connectors
  5. Bread Boards

Steps:

  1. Connect the particular pins of LCD to Arduino UNO pins. Here is an schematic and chart given.
  2. Upload the code to arduino UNO .

Schematic:

P2P Chart:

Arduino Code:

#include <LiquidCrystal.h>

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

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.setCursor(0,0);
  lcd.print("Hello World");

}

void loop() {
  // Turn off the display:
  lcd.noDisplay();
  delay(500);
  // Turn on the display:
  lcd.display();
  delay(2000);
}

You can also use the code given below,

#include <LiquidCrystal.h>

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

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  
}

void loop() {
  lcd.display();
  lcd.setCursor(0,0);
  lcd.print("Welcome to.....");
  lcd.setCursor(0,1);
  lcd.print("About Sciences");
  delay(3000);
  lcd.setCursor(0,0);
  lcd.print("Bring Sciences");
  lcd.setCursor(0,1);
  lcd.print("to your Life..");
  delay(4000);
 }

This code is applicable for 16*2 display. A slight change is needed to use it for 20*4.


To use 20*4 display change “lcd.begin(16, 2)” to

lcd.begin(20,4);

also you can show messages in 4 lines(rows) by just setting up cursor from lcd.setCursor(0,0) to lcd.setCursor(0,3).

Here is a sample code,

#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
  
  lcd.begin(20,4);
  
  lcd.setCursor(0,0);
  lcd.print("Welcome to");
  lcd.setCursor(0,1);
  lcd.print("AboutSciences");
  lcd.setCursor(0,2);
  lcd.print("Bring Sciences");
  lcd.setCursor(0,3);
  lcd.print("to your life");
}
void loop() {

  lcd.noDisplay();
  delay(500);
   
  lcd.display();
  delay(2000);
}

Leave a Reply

Your email address will not be published. Required fields are marked *