Interfacing LCD16x2 with Arduino (AVR Atmega328P)

LCD16x2 is commonly used display in maximum electronics project for displaying information like sensors data from your project, and also they are very cheap,So hear its small demo of this display interfacing with Arduino(Atmega328P)

Demo Video

Connection Diagram

 

Componets

  • 16×2 LCD
  • Arduino UNO R3 Board
  • Breadboard and Jumper Wire

Source Code

#include <EMLcd.h>
EMLcd lcd(4,5,6,7,8,9);
char line1[16];

uint16_t c=0;

void setup() {
  lcd.init();
  lcd.clear();
  lcd.print_xy(0,0,"Embedded Makers");
  lcd.print_xy(0,1,"LCD16x2 Demo");
  delay(1000);
  lcd.clear();
}

void loop() {

  sprintf(line1,"Counter : %d",c++);
  lcd.print_xy(0,0,"Variables");
  lcd.print_xy(0,1,line1);
  delay(1000);
  lcd.clear();
}

 

Leave a Reply

Your email address will not be published.