0% found this document useful (0 votes)
7 views3 pages

Arduino LCD I2C Display Example Code

Uploaded by

panscheck42
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)
7 views3 pages

Arduino LCD I2C Display Example Code

Uploaded by

panscheck42
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 <Wire.h>

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address

/*—–( Declare Constants )—–*/

//none

/*—–( Declare objects )—–*/

// set the LCD address to 0x27 for a 20 chars 4 line display

// Set the pins on the I2C chip used for LCD connections:

// addr, en,rw,rs,d4,d5,d6,d7,bl,blpol

void setup() {

// put your setup code here, to run once:

[Link](9600); // Used to type in characters

[Link](20,4); // initialize the lcd for 20 chars 4 lines and turn on backlight

// ——- Quick 3 blinks of backlight ————-

for(int i = 0; i< 3; i++)

[Link]();

delay(250);

[Link]();

delay(250);

}
[Link](); // finish with backlight on

//——– Write characters on the display —————-

// NOTE: Cursor Position: CHAR, LINE) start at 0

[Link](3,0); //Start at character 4 on line 0

[Link](“Hello, world!”);

delay(1000);

[Link](2,1);

[Link](“From YourDuino”);

delay(1000);

[Link](0,2);

[Link](“20 by 4 Line Display”);

[Link](0,3);

delay(2000);

[Link](“[Link]

delay(8000);

// Wait and then tell user they can start the Serial Monitor and type in characters to

// Display. (Set Serial Monitor option to “No Line Ending”)

[Link](0,0); //Start at character 0 on line 0

[Link](“Start Serial Monitor”);

[Link](0,1);

[Link](“Type chars 2 display”);

void loop() {
// put your main code here, to run repeatedly:

// when characters arrive over the serial port…

if ([Link]()) {

// wait a bit for the entire message to arrive

delay(100);

// clear the screen

[Link]();

// read all the available characters

while ([Link]() > 0) {

// display each character to the LCD

[Link]([Link]());

You might also like