0% found this document useful (0 votes)
9 views2 pages

LCD I2C Initialization Tutorial

This document provides a code snippet for using an I2C LCD with an Arduino. It includes necessary library imports, wiring instructions, and setup for displaying 'Hello World!' and 'LCD tutorial' on the LCD screen. The code initializes the LCD and sets the cursor to print the specified messages on the display.

Uploaded by

Mohammad Irfan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

LCD I2C Initialization Tutorial

This document provides a code snippet for using an I2C LCD with an Arduino. It includes necessary library imports, wiring instructions, and setup for displaying 'Hello World!' and 'LCD tutorial' on the LCD screen. The code initializes the LCD and sets the cursor to print the specified messages on the display.

Uploaded by

Mohammad Irfan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

// Include the libraries:

// LiquidCrystal_I2C.h: [Link]

#include <Wire.h> // Library for I2C communication

#include <LiquidCrystal_I2C.h> // Library for LCD

// Wiring: SDA pin is connected to A4 and SCL pin to A5.

// Connect to LCD via I2C, default address 0x27 (A0-A2 not jumpered)

LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 16, 2); // Change to (0x27,20,4)


for 20x4 LCD.

void setup() {

// Initiate the LCD:

[Link]();

[Link]();

void loop() {

// Print 'Hello World!' on the first line of the LCD:

[Link](2, 0); // Set the cursor on the third column and first row.

[Link]("Hello World!"); // Print the string "Hello World!"

[Link](2, 1); //Set the cursor on the third column and the second row
(counting starts at 0!).

[Link]("LCD tutorial");

You might also like