Function
详细解释
LiquidCrystal建立一个LiquidCrystal类型变量
Description描述
Syntax语法
LiquidCrystal(rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7)
Parameters参数
寄存器选择引脚
rw: the number of the Arduino pin that is connected to the RW pin on the LCD (optional) 读写引脚
使能引脚
数据引脚,8个或4个
Example示例
#include <LiquidCrystal.h>
setup()
{
}
loop
begin() 初始化LCD的界面
Description
begin()
needs to be called before any other LCD library commands.
Syntax
lcd.begin(cols, rows)
Parameters
cols: the number of columns that the display has
clear() 清屏,光标在左上角
Description
Clears the LCD screen and positions the cursor in the upper-left corner.
Syntax
lcd.clear()
Parameters
home() 光标定位于左上角
Description
Syntax
lcd.home()
Parameters
setCursor() 设置光标位置
Description
Position the LCD cursor; that is, set the location at which subsequent text written to the LCD will be displayed.
Syntax
lcd.setCursor(col, row)
Parameters
col: the column at which to position the cursor (with 0 being the first column)
write() 写一个字符
Description
Write a character to the LCD.
Syntax
lcd.write(data)
Parameters
data: the character to write to the display
Returns
byte
write() will return the number of bytes written, though reading that number is optional
Example
#include <LiquidCrystal.h>
setup()
{
}
loop()
{
}
在LCD上显示一个文本
Description
Prints text to the LCD.
Syntax
lcd
lcd.print(data, BASE)
Parameters
data: the data to print (char, byte, int, long, or string)
BASE (optional): the base in which to print numbers: BIN for binary (base 2), DEC for decimal (base 10), OCT for octal (base 8), HEX for hexadecimal (base 16).
Returns
byte
print() will return the number of bytes written, though reading that number is optional
Example
#include <LiquidCrystal.h>
setup()
{
}
loop
显示光标
Description
Display the LCD cursor: an underscore (line) at the position to which the next character will be written.
Syntax
lcd.cursor()
Parameters
不显示光标
Description
Hides the LCD cursor.
Syntax
lcd.noCursor()
Parameters
blink() 光标闪烁
Description
cursor() function, the result will depend on the particular display.
Syntax
lcd.blink()
Parameters
noBlink() 光标不闪烁
Description
Turns off the blinking LCD cursor.
Syntax
lcd.noBlink()
Parameters
显示
Description
noDisplay(). This will restore the text (and cursor) that was on the display.
Syntax
lcd.display()
Parameters
不显示
Description
Turns off the LCD display, without losing the text currently shown on it.
Syntax
lcd.noDisplay()
Parameters
滚动显示的内容往左一个位置
Description
Scrolls the contents of the display (text and cursor) one space to the left.
Syntax
lcd.scrollDisplayLeft()
Parameters
scrollDisplayRight() 滚动显示的内容往右一个位置
Description
Scrolls the contents of the display (text and cursor) one space to the right.
Syntax
lcd.scrollDisplayRight()
Parameters
输入时光标在一个固定位置,字符自动移动
Description
Turns on automatic scrolling of the LCD. This causes each character output to the display to push previous characters over by one space. If the current text direction is left-to-right (the default), the display scrolls to the left; if the current direction is right-to-left, the display scrolls to the right. This has the effect of outputting each new character to the same location on the LCD.
Syntax
lcd.autoscroll()
Parameters
noAutoscroll() 关闭输入时字符自动移动
Description
Turns off automatic scrolling of the LCD.
Syntax
lcd.noAutoscroll()
Parameters
leftToRight() 文本显示时的移动方向是从左往右
Description
Set the direction for text written to the LCD to left-to-right, the default. This means that subsequent characters written to the display will go from left to right, but does not affect previously-output text.
Syntax
lcd.leftToRight()
Parameters
rightToLeft() 文本显示时的移动方向是从右往左
Description
Set the direction for text written to the LCD to right-to-left (the default is left-to-right). This means that subsequent characters written to the display will go from right to left, but does not affect previously-output text.
Syntax
lcd.rightToLeft()
Parameters
createChar() 建立一个自定义的图形字符
Description
write() its number.
NB : When referencing custom character "0", if it is not in a variable, you need to cast it as a byte, otherwise the compiler throws an error. See the example below.
Syntax
lcd.createChar(num, data)
Parameters
num: which character to create (0 to 7)
data: the character‘s pixel data
Example
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
byte smiley[8] =
{
};
void setup()
{
}
void loop() {}
原文:https://www.cnblogs.com/MyAutomation/p/9374896.html