Hardware components | ||||||
| × | 1 | ||||
| × | 1 | ||||
Software apps and online services | ||||||
|
In this tutorial I explain:
how LCD display works
how to connect it to Arduino
explain all methods provided with LiquidCrystal.h library
Hope you will find this tutorial helpful
If you like this content and you want to support me in creating similar videos go to my Patreon webpage https://www.patreon.com/MariosIdeas
Or
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7PD67JWZ9S3EJ&source=url
- Code example : lcd print, lcd.setCursor,
- Code example: lcd. autoscroll, lcd.noautoscroll
- Code example: lcd.scroll
- Code example: lcd.blink, lcd.noblink, lcd.clear
- Code example: lcd.createChar - creating single custom character
- Code example: lcd.createChar - creating composite clipart out of multiple custom characters
- Code example: lcd.lefttoRight, lcd.righttoLeft, lcd.home, lcd.display, lcd.nodisplay
#include <LiquidCrystal.h>
const int rs = 2,
en = 3,
d4 = 6,
d5 = 7,
d6 = 8,
d7 = 9;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
lcd.begin(16, 2);
Serial.begin(9600);
lcd.setCursor(0, 0);
lcd.print("Hello world");
}
#include <LiquidCrystal.h>
const int rs = 2,
en = 3,
d4 = 6,
d5 = 7,
d6 = 8,
d7 = 9;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
lcd.begin(16, 2);
Serial.begin(9600);
}
String Mario="Mario's Ideas ";
void loop() {
lcd.clear() ; //d
delay(3000);//d
for(int i=0;i<Mario.length();i++){
lcd.print(Mario.charAt(i));
delay(200);
}
lcd.setCursor(16, 1);
lcd.autoscroll();
for(int i=0;i<Mario.length();i++){
lcd.print(Mario.charAt(i));
delay(400);
}
lcd.noAutoscroll();
lcd.clear();
}
#include <LiquidCrystal.h>
const int rs = 2,
en = 3,
d4 = 6,
d5 = 7,
d6 = 8,
d7 = 9;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
lcd.begin(16, 2);
Serial.begin(9600);
lcd.clear();
delay(2000);
lcd.print("PATREON");
}
void loop() {
delay(4000);
for (int pos = 0; pos < 23; pos++) {
lcd.scrollDisplayRight();
delay(250);
}
for (int pos = 0; pos < 23; pos++) {
lcd.scrollDisplayLeft();
delay(250);
}
}
#include <LiquidCrystal.h>
const int rs = 2,
en = 3,
d4 = 6,
d5 = 7,
d6 = 8,
d7 = 9;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
lcd.begin(16, 2);
Serial.begin(9600);
}
String Hello="Hello World!";
void loop() {
lcd.clear(); //d
delay(4000);//
lcd.blink();
lcd.setCursor(0, 0);
delay(6000); //2000
for(int i=0;i<Hello.length();i++){
lcd.print(Hello.charAt(i));
delay(400);
}
delay(6000);//2000
lcd.noBlink();
delay(3000);
lcd.clear();
}
#include <LiquidCrystal.h>
const int rs = 2,
en = 3,
d4 = 6,
d5 = 7,
d6 = 8,
d7 = 9;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
byte bot[8] = {
0b01110,
0b01110,
0b00100,
0b11111,
0b00100,
0b00100,
0b01010,
0b10001
};
void setup() {
lcd.begin(16, 2);
Serial.begin(9600);
lcd.createChar(0,bot);
lcd.clear();
delay(2000);
}
void loop() {
lcd.setCursor(0, 0);
lcd.write(byte(0));
delay(6000);
for (int j=0;j<2;j++)
for (int i=0;i<16;i++){
lcd.setCursor(i, j);
lcd.write(byte(0));
delay(100);
}
}
#include <LiquidCrystal.h>
const int rs = 2,
en = 3,
d4 = 6,
d5 = 7,
d6 = 8,
d7 = 9;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
byte S1[8] = {
0b00000,
0b00000,
0b00011,
0b00100,
0b01000,
0b01000,
0b10000,
0b10000
};
byte S2[8] = {
0b00000,
0b11111,
0b00000,
0b00000,
0b00000,
0b11011,
0b11011,
0b11011
};
byte S3[8] = {
0b00000,
0b00000,
0b11000,
0b00100,
0b00010,
0b00010,
0b00001,
0b00001
};
byte S4[8] = {
0b10000,
0b10010,
0b01001,
0b01000,
0b00100,
0b00011,
0b00000
};
byte S5[8] = {
0b00000,
0b00000,
0b00000,
0b11111,
0b00000,
0b00000,
0b11111
};
byte S6[8] = {
0b00001,
0b01001,
0b10010,
0b00010,
0b00100,
0b11000,
0b00000
};
void setup() {
lcd.begin(16, 2);
Serial.begin(9600);
lcd.begin(16, 2);
// create a new character
lcd.createChar(0,S1);
// create a new character
lcd.createChar(1,S2);
// create a new character
lcd.createChar(2,S3);
// create a new character
lcd.createChar(3,S4);
// create a new character
lcd.createChar(4,S5);
// create a new character
lcd.createChar(5,S6);
lcd.clear();
delay(3000);
}
void loop() {
// set the cursor to the top left
lcd.setCursor(0, 0);
lcd.write(byte(0));
lcd.write((byte)1);
lcd.write((byte)2);
lcd.setCursor(0, 1);
lcd.write((byte)3);
lcd.write((byte)4);
lcd.write((byte)5);
}
#include <LiquidCrystal.h>
const int rs = 2,
en = 3,
d4 = 6,
d5 = 7,
d6 = 8,
d7 = 9;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
lcd.begin(16, 2);
Serial.begin(9600);
}
String Hello="Hello World!";
void loop() {
lcd.clear(); delay(4000);
lcd.setCursor(7, 0);
lcd.rightToLeft();
lcd.print("TFEL-<");
delay(4000);
lcd.setCursor(7, 1);
lcd.leftToRight();
lcd.print("RIGHT->");
delay(2000);
lcd.blink();delay(4000);
lcd.home();delay(4000);
lcd.noDisplay(); delay(4000);
lcd.display(); delay(4000);
lcd.clear(); delay(4000);
}
Comments