LiquidCrystal()

描述

LiquidCrystal 类别实作控制液晶显示器的功能。

LiquidCrystal 类别同时支援 4 或 8 条资料线的连接方式。如果使用 4 条资料线连接,建构 LiquidCrystal 物件时,忽略 d0 ~ d3 的参数。如果 RW 脚位是接地,而不是连接到 86Duino,忽略 rw 这个参数。

语法


LiquidCrystal(rs, enable, d4, d5, d6, d7)
LiquidCrystal(rs, rw, enable, d4, d5, d6, d7)
LiquidCrystal(rs, enable, d0, d1, d2, d3, d4, d5, d6, d7)
LiquidCrystal(rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7)

参数

rs:86Duino 上与液晶显示器 RS 连接的脚位编号
rw:86Duino 上与液晶显示器 RW 连接的脚位编号,rw 参数为选填
enable:86Duino 上与液晶显示器 enable 连接的脚位编号
d0, d1, d2, d3, d4, d5, d6, d7:86Duino 上与液晶显示器资料线连接的脚位编号。 d0 ~ d3 参数为选填,如果没有给予 d0 ~ d3 参数,将只会使用 d4 ~ d7 四条资料线。

范例

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

void setup()
{
  lcd.begin(16,1);
  lcd.print("hello, world!");
}

void loop() {}

函式库参考主页面

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.