Skip to content

Instantly share code, notes, and snippets.

@dkrkamesh dkrkamesh/I2C type LCD.ino
Last active Apr 22, 2019

What would you like to do?
Display the heart rate data on I2C type 16x2 LCD
#include <Wire.h> // Comes with Arduino IDE
#include <LiquidCrystal_I2C.h>
// Initialize the object with interfacing pins
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
void setup()
Serial.begin(9600); // Initialize serial communication at 9600 baudrate
lcd.begin(16,2); // Initialize 16X2 LCD and turn on backlight
lcd.setCursor(0,0); // Set cursor to column 1, line 1
lcd.write(" 16x2 character ");
lcd.setCursor(0,1); // Set cursor to column 1, line 2
lcd.write(" I2C LCD ");
delay(2000); // Display for sometime
lcd.noBacklight(); // Turn off backlight
delay(2000); // Turn on backlight again after sometime
lcd.clear(); // Clear the display
lcd.write("Use Serial Monitor");
lcd.write("Type to display");
void loop() // Setup - Runs continuously
if(Serial.available()) // True if any character has arrived
lcd.clear(); // Clear the display
while (Serial.available() > 0)
lcd.write(; // Display all the characters on LCD

This comment has been minimized.

Copy link

randolfagbai commented Apr 22, 2019

These initializations line 3 was missing. POSITIVE was not also declared. This code can,t compile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.