Monday, June 13, 2016

Wiring a 16x2 LCD display with Arduino

The schematic below shows how to wire a 16x2 LCD display with an Arduino board. We can use any LCD display that is compatible with the Hitachi HD44780 driver. Besides the Arduino board and LCD panel, we will also need a 10K potentiometer to adjust the contrast of the characters on the LCD screen.

Part List:
  1. Arduino Board
  2. 16x2 character LCD display
  3. 10K potentiometer
Wiring:


The Code:

#include <LiquidCrystal.h>

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

void setup(){
    lcd.begin(16, 2);
    lcd.print("Elapsed Time:");
}

void loop(){ 
    // Counting begins from 0
    // (0,1) means 1st character of 2nd line
    lcd.setCursor(0, 1);
    lcd.print(millis()/1000);
    lcd.print(" sec");
}

No comments: