Library And Arduino Code For LCD2004 Display With I2C - Robojax
Maybe your like
Library and Arduino code for LCD2004 display with I2C
دروس آردوینو به فارسی
Arduino code for LCD2004 with I2C module
In this page we have got two Arduino sketch. There are various code to display data on LCD2004-I2C. You need to download the Liquid Crystal library.
Run I2C scanner to get the address from this page- Get Library from Gethub
- Get Library from Robojax.com
- Character Generator (GetHub)
- Character Generator (2nd source)
- Robojax Crash Course on Arduino: Learn Arduino in 30 Minutes (code and video)
- Learn Arduino step by step from beginner to Advance (Coruse)
- Get Early Access to my videos via Patreon
Arduino Code for LCD2004 with I2C Hello World sketch
This code prints simple Hello World text on screen
/* * Download library: https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library * * Updated by Ahmad Shamshiri on July 08, 2018 at 19:14 in Ajax, Ontario, Canada * for Robojax.com * Get this code from Robojax.com * Watch video instruction for this code at:https://youtu.be/DKmNSCMPDjE * */ #include <Wire.h> #include <LiquidCrystal_I2C.h> // Set the LCD address to 0x27 for a 20 chars and 4 line display LiquidCrystal_I2C lcd(0x27, 20, 4); void setup() { // initialize the LCD lcd.begin(); // Turn on the blacklight and print a message. lcd.backlight(); lcd.print("Hello, world!"); } void loop() { // Do nothing here... }Arduino Code for LCD2004 with I2C Robojax Custom sketch
This code prints values from variable or sensors with texts on the same line or in multiple lines.
/* * * * Download library: https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library * This code is basic usage of LCD2004 display with I2C * It will display text in 4 lines each with 20 characters * It Displays multiple float values and text on the same line * * * * Updated by Ahmad Shamshiri on July 08, 2018 at 09:20 in Ajax, Ontario, Canada * for Robojax.com * Get this code from Robojax.com * Watch video instruction for this code at:https://youtu.be/DKmNSCMPDjE * */ #include <Wire.h> #include <LiquidCrystal_I2C.h> // Set the LCD address to 0x27 for a 20 chars and 4 line display LiquidCrystal_I2C lcd(0x27, 20, 4); void setup() { // initialize the LCD, lcd.begin(); // Turn on the blacklight and print a message. lcd.backlight(); lcd.clear(); lcd.setCursor (0,0); // lcd.print("Robojax LCD2004 Test"); lcd.setCursor (0,1); // lcd.print("Please Wait - 3"); lcd.setCursor (0,1); // delay(1000); lcd.print("Please Wait - 2"); delay(1000); lcd.setCursor (0,1); // lcd.print("Please Wait - 1"); delay(1000); } void loop() { // Robojax.com LCD2004 with I2C custom code lcd.clear();// clearn previous values from screen lcd.setCursor (0,0); //character zero, line 1 lcd.print("LCD2004 I2C Example"); // print text lcd.setCursor (4,1); //character 4, line 2 lcd.print("Robojax.com"); // print text lcd.setCursor (0,2); //character 0, line 3 lcd.print("Voltage: "); // print text float v = 8.254;// define or get voltage char VoltageStr[5]; dtostrf(v, 5, 3, VoltageStr ); lcd.setCursor (9,2); //character 9, line 3 lcd.print(VoltageStr); // print voltage lcd.setCursor (14,2); //character 14, line 3 lcd.print("V"); // print V at the end of voltage lcd.setCursor (0,3); //character 0, line 4 lcd.print("X: "); // print x float xdeg = -123.87;// define or get x degree (just example) lcd.setCursor (3,3); //character 8, line 3 lcd.print(xdeg); // print xdeg value lcd.setCursor (12,3); //character 12, line 4 lcd.print("Y: "); // print Y float ydeg = 32.8;// define or get y degree (just example) lcd.setCursor (15,3); //character 15, line 4 lcd.print(ydeg); // print ydeg value delay(100); }// loop endArduino Code for LCD2004 with I2C Blinking sketch
This code will display blinking cursor on the screen.
/* * * Download library: https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library * This code is basic usage of LCD2004 display with I2C * It will display blinking cursor on screen * * Get this code from Robojax.com * Watch video instruction for this code at:https://youtu.be/DKmNSCMPDjE * */ #include <Wire.h> #include <LiquidCrystal_I2C.h> // Set the LCD address to 0x27 for a 20 chars and 4 line display LiquidCrystal_I2C lcd(0x27, 20, 4); void setup() { // initialize the LCD lcd.begin(); } void loop() { bool blinking = true; lcd.cursor(); while (1) { if (blinking) { lcd.clear(); lcd.print("No cursor blink"); lcd.noBlink(); blinking = false; } else { lcd.clear(); lcd.setCursor(0,1); lcd.print("Your name: "); lcd.blink(); blinking = true; } delay(4000); } }Arduino Code for LCD2004 with I2C Serial monitor sketch
This code prints characters you type on the serial monitor.
/* * * Download library: https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library * This code is basic usage of LCD2004 display with I2C * It code will allow you to enter character on the serial monitor and display it on this screen * * Updated by Ahmad Shamshiri on July 08, 2018 at 09:20 in Ajax, Ontario, Canada * for Robojax.com * Get this code from Robojax.com * Watch video instruction for this code at:https://youtu.be/DKmNSCMPDjE * */ #include <Wire.h> #include <LiquidCrystal_I2C.h> // Set the LCD address to 0x27 for a 20 chars and 4 line display LiquidCrystal_I2C lcd(0x27, 20, 04); char lastChar ='_'; void setup() { lcd.begin(); lcd.backlight(); lcd.print("Robojax.com Test"); // Initialize the serial port at a speed of 9600 baud Serial.begin(9600); } void loop() { lcd.clear(); lcd.setCursor(0,1); lcd.print("Enter Letter: "); lcd.setCursor(13,1); // If characters arrived over the serial port... if (Serial.available()) { // Wait a bit for the entire message to arrive delay(100); // Write all characters received with the serial port to the LCD. while (Serial.available() > 0) { lastChar =Serial.read(); Serial.print("Entered: "); Serial.println(lastChar); }//while end }// if end lcd.write(lastChar);// display last entered character delay(1000); }// loop endTag » Arduino I2c Lcd 2004 Example
-
Character I2C LCD With Arduino Tutorial (8 Examples)
-
Introduction To LCD2004 LCD Display With I2C Module For Arduino
-
Example Of 20x4 LCD With I2C That Works? - Displays - Arduino Forum
-
How To Use A 20x4 I2C Character LCD Display With Arduino
-
LCD 2004 (20x4) I2C Library - Displays - Arduino Forum
-
[SOLVED] I2C MH + LCD 2004A + Arduino Uno Display Issues ...
-
LCD I2C | Arduino Tutorial
-
I2C LCD On Arduino - Stunningly Easily Setup And Control
-
How To Use I2C Serial LCD 20X4 (Yellow Backlight) - Instructables
-
In-Depth: Interfacing An I2C LCD With Arduino
-
I2C LCD With ESP32 On Arduino IDE - ESP8266 Compatible
-
Using A 20x4 I2C Character LCD Display With Arduino Uno
-
Hiển Thị Thời Gian Thực Lên LCD 20x4 I2C Dùng Arduino