// 接線說明
// +----------+-----------+----------+
// | Arduino | IO編號 | 20x2 LCD |
// +----------+-----------+----------+
// | D22 | 49 | E |
// | D23 | 50 | R/W |
// | D24 | 51 | RS |
// +----------+-----------+----------+
// | D30 | 57 | D0 |
// | D31 | 58 | D1 |
// | D32 | 59 | D2 |
// | D33 | 60 | D3 |
// | D34 | 61 | D4 |
// | D35 | 62 | D5 |
// | D36 | 63 | D6 |
// | D37 | 64 | D7 |
// +----------+-----------+----------+
#include "LiquidCrystalEx.h"
//將腳位設定,此為利用8條資料線控制
//LiquidCrystalEx::LiquidCrystalEx(rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7)
LiquidCrystalEx lcd( 24, 23, 22, 30, 31, 32, 33, 34, 35, 36, 37);
void setup()
{
//設定該LCD的文字長度與幾行
lcd.begin(20, 2);
// 將文字印在LCD上
lcd.print("Hello!!");
}
void loop()
{
}
// 接線說明
// +----------+-----------+----------+
// | Arduino | IO編號 | 20x2 LCD |
// +----------+-----------+----------+
// | D30 | 57 | E |
// | D31 | 58 | R/W |
// | D32 | 59 | RS |
// | D33 | 60 | - |
// | D34 | 61 | D4 |
// | D35 | 62 | D5 |
// | D36 | 63 | D6 |
// | D37 | 64 | D7 |
// +----------+-----------+----------+
#include "LiquidCrystalEx.h"
//將腳位設定,此為利用4條資料線控制
//LiquidCrystalEx::LiquidCrystalEx(rs, rw, enable, d4, d5, d6, d7)
LiquidCrystalEx lcd( 32, 31, 30, 34, 35, 36, 37);
void setup()
{
//設定該LCD的文字長度與幾行
lcd.begin(20, 2);
// 將文字印在LCD上
lcd.print("Hello!!");
}
void loop()
{
}
// 接線說明
// +----------+-----------+----------+
// | Arduino | IO編號 | 20x2 LCD |
// +----------+-----------+----------+
// | D30 | 57 | E |
// | D31 | 58 | R/W |
// | D32 | 59 | RS |
// | D33 | 60 | - |
// | D34 | 61 | D4 |
// | D35 | 62 | D5 |
// | D36 | 63 | D6 |
// | D37 | 64 | D7 |
// +----------+-----------+----------+
#include "LiquidCrystalEx.h"
//將腳位設定,此為利用4條資料線控制
//LiquidCrystalEx::LiquidCrystalEx(rs, rw, enable, d4, d5, d6, d7)
LiquidCrystalEx lcd( 32, 31, 30, 34, 35, 36, 37);
void setup()
{
//設定該LCD的文字長度與幾行
lcd.begin(20, 2);
//設定顯示從第0行的第7格開始
lcd.setCursor(7,0);
// 將文字印在LCD上
lcd.print("Hello!!");
}
void loop()
{
}
// 接線說明
// +----------+-----------+----------+
// | Arduino | IO編號 | 20x2 LCD |
// +----------+-----------+----------+
// | D30 | 57 | E |
// | D31 | 58 | R/W |
// | D32 | 59 | RS |
// | D33 | 60 | - |
// | D34 | 61 | D4 |
// | D35 | 62 | D5 |
// | D36 | 63 | D6 |
// | D37 | 64 | D7 |
// +----------+-----------+----------+
#include "LiquidCrystalEx.h"
//將腳位設定,此為利用4條資料線控制
//LiquidCrystalEx::LiquidCrystalEx(rs, rw, enable, d4, d5, d6, d7)
LiquidCrystalEx lcd( 32, 31, 30, 34, 35, 36, 37);
void setup()
{
//設定該LCD的文字長度與幾行
lcd.begin(20, 2);
//設定顯示從第0行的第7格開始
lcd.setCursor(0,0); //設定顯示從第0行的第0格開始
lcd.print("Hi! I am"); // 將文字印在LCD上
lcd.setCursor(0,1); //設定顯示從第1行的第0格開始
lcd.print("Lin Zhongxian"); // 將文字印在LCD上
}
void loop()
{
}
// 接線說明
// +----------+-----------+----------+
// | Arduino | IO編號 | 20x2 LCD |
// +----------+-----------+----------+
// | D30 | 57 | E |
// | D31 | 58 | R/W |
// | D32 | 59 | RS |
// | D33 | 60 | - |
// | D34 | 61 | D4 |
// | D35 | 62 | D5 |
// | D36 | 63 | D6 |
// | D37 | 64 | D7 |
// +----------+-----------+----------+
#include "LiquidCrystalEx.h"
//將腳位設定,此為利用4條資料線控制
//LiquidCrystalEx::LiquidCrystalEx(rs, rw, enable, d4, d5, d6, d7)
LiquidCrystalEx lcd( 32, 31, 30, 34, 35, 36, 37);
void setup()
{
//設定該LCD的文字長度與幾行
lcd.begin(20, 2);
//游標位置閃爍
lcd.blink();
}
void loop()
{
// 印出0~9:
for (int thisChar = 0; thisChar < 10; thisChar++){
lcd.print(thisChar);
delay(500);
}
// 設定游標為(19,1):
lcd.setCursor(19, 1);
//設定為捲動的方式顯示文字
lcd.autoscroll();
//印出0~9:
for (int thisChar = 0; thisChar < 10; thisChar++){
lcd.print(thisChar);
delay(500);
}
// 關閉捲動
lcd.noAutoscroll();
// LCD清除:
lcd.clear();
}
// 接線說明
// +----------+-----------+----------+
// | Arduino | IO編號 | 20x2 LCD |
// +----------+-----------+----------+
// | D30 | 57 | E |
// | D31 | 58 | R/W |
// | D32 | 59 | RS |
// | D33 | 60 | - |
// | D34 | 61 | D4 |
// | D35 | 62 | D5 |
// | D36 | 63 | D6 |
// | D37 | 64 | D7 |
// +----------+-----------+----------+
#include "LiquidCrystalEx.h"
//將腳位設定,此為利用4條資料線控制
//LiquidCrystalEx::LiquidCrystalEx(rs, rw, enable, d4, d5, d6, d7)
LiquidCrystalEx lcd( 32, 31, 30, 34, 35, 36, 37);
void setup()
{
//設定該LCD的文字長度與幾行
lcd.begin(20, 2);
//游標位置閃爍
lcd.cursor();
lcd.print("Hello!!");
}
void loop()
{
//顯示
lcd.display();
delay(500);
//不顯示
lcd.noDisplay();
delay(500);
}
// 接線說明
// +----------+-----------+----------+
// | Arduino | IO編號 | 20x2 LCD |
// +----------+-----------+----------+
// | D30 | 57 | E |
// | D31 | 58 | R/W |
// | D32 | 59 | RS |
// | D33 | 60 | - |
// | D34 | 61 | D4 |
// | D35 | 62 | D5 |
// | D36 | 63 | D6 |
// | D37 | 64 | D7 |
// +----------+-----------+----------+
#include "LiquidCrystalEx.h"
//將腳位設定,此為利用4條資料線控制
//LiquidCrystalEx::LiquidCrystalEx(rs, rw, enable, d4, d5, d6, d7)
LiquidCrystalEx lcd( 32, 31, 30, 34, 35, 36, 37);
//利用char 陣列的方式存放內容,需有結尾字元
char Word1[] = {'H','e','l','l','o','!','!','\0'};
//也可使用16進制的方式表示,但需查看LCD內建字碼
char Word2[] = {0x48,0x65,0x6C,0x6C,0x6F,0x21,'\0'};
void setup()
{
//設定該LCD的文字長度與幾行
lcd.begin(20, 2);
lcd.print(Word1); //顯示Word1內容
lcd.setCursor(0,1);
lcd.print(Word2); //顯示Word2內容
}
void loop()
{
}
// 接線說明
// +----------+-----------+----------+
// | Arduino | IO編號 | 20x2 LCD |
// +----------+-----------+----------+
// | D30 | 57 | E |
// | D31 | 58 | R/W |
// | D32 | 59 | RS |
// | D33 | 60 | - |
// | D34 | 61 | D4 |
// | D35 | 62 | D5 |
// | D36 | 63 | D6 |
// | D37 | 64 | D7 |
// +----------+-----------+----------+
#include "LiquidCrystalEx.h"
//將腳位設定,此為利用4條資料線控制
//LiquidCrystalEx::LiquidCrystalEx(rs, rw, enable, d4, d5, d6, d7)
LiquidCrystalEx lcd( 32, 31, 30, 34, 35, 36, 37);
// 自定義一個文字
byte heart[8] =
{
0b01010,
0b10101,
0b10001,
0b10001,
0b10001,
0b01010,
0b00100,
0b00000
};
void setup()
{
//將自定義存放到LCD的RAM中
lcd.createChar (0, heart); // load heart to memory 0
//設定該LCD的文字長度與幾行
lcd.begin(20, 2);
//顯示自定義文字
lcd.write(byte(0)); //display a heart
}
void loop()
{
}
// 接線說明
// +----------+-----------+----------+
// | Arduino | IO編號 | 20x2 LCD |
// +----------+-----------+----------+
// | D30 | 57 | E |
// | D31 | 58 | R/W |
// | D32 | 59 | RS |
// | D33 | 60 | - |
// | D34 | 61 | D4 |
// | D35 | 62 | D5 |
// | D36 | 63 | D6 |
// | D37 | 64 | D7 |
// +----------+-----------+----------+
#include "LiquidCrystalEx.h"
//將腳位設定,此為利用4條資料線控制
//LiquidCrystalEx::LiquidCrystalEx(rs, rw, enable, d4, d5, d6, d7)
LiquidCrystalEx lcd( 32, 31, 30, 34, 35, 36, 37);
// Create a set of new characters
byte smiley[8] = {
B00000, B01010,B00000,B00000,B10001,B01110,B00000,B00000
};
byte heart_h[8] = {
B00000,B00000,B01010,B10101,B10001,B01010,B00100, B00000
};
byte heart_f[8] = {
B00000,B00000,B01010,B11111,B11111,B01110,B00100, B00000
};
byte ohm[8] = {
B00000,B01110,B10001,B10001,B10001,B01010,B01010, B11011
};
byte rect[8] = {
B11111,B10001,B10001,B10001,B10001,B10001,B10001,B11111
};
byte arrow_u[8] = {
B00100,B01110,B11111,B00100,B00100,B00100,B00100, B00100
};
byte arrow_d[8] = {
B00100,B00100,B00100,B00100, B00100, B11111,B01110,B00100
};
byte diamond[8] = {
B00000,B00100,B01010,B10001, B01010,B00100,B00000,B00000
};
int z=1;
void setup()
{
//設定該LCD的文字長度與幾行
lcd.begin(20, 2);
lcd.createChar (0, smiley); // load smiley to memory 0
lcd.createChar (1, heart_h); // load heart_h to memory 1
lcd.createChar (2, heart_f); // load heart_f to memory 2
lcd.createChar (3, ohm); // load ohm to memory 3
lcd.createChar (4, rect); // load rect to memory 4
lcd.createChar (5, arrow_u); // load arrow_u to memory 5
lcd.createChar (6, arrow_d); // load arrow_d to memory 6
lcd.createChar (7, diamond); // load diamond to memory 7
lcd.clear(); //clear the screen
lcd.setCursor(0,0); //set cursor to upper left corner
lcd.print(char(0)); //display a smiley
lcd.print(char(1)); //display a hollow heart
lcd.print(char(2)); //display a filled heart
lcd.print(char(3)); //display a ohm
lcd.print(char(4)); //display a rectangle
lcd.print(char(5)); //display a arrow
lcd.print(char(6)); //display a rectangle
lcd.print(char(7)); //display a arrow
}
void loop()
{
z= z +1;
lcd.setCursor(0,1); //set cursor to bottom left second line
lcd.print(char(0));
lcd.print(char(z));
lcd.print(char(3));
lcd.print(char(0));
if (z==2)
z=0;
delay(500);
}