这里会显示出您选择的修订版和当前版本之间的差别。
| — |
en:arduino:libraries:liquidcrystalconstructor [2016/12/25 22:15] (当前版本) |
||
|---|---|---|---|
| 行 1: | 行 1: | ||
| + | [[en:arduino:libraries:liquidcrystal|LiquidCrystal]] | ||
| + | ====== LiquidCrystal() ====== | ||
| + | |||
| + | ===== Description ===== | ||
| + | |||
| + | Creates a variable of type LiquidCrystal. The display can be controlled using 4 or 8 data lines. If the former, omit the pin numbers for d0 to d3 and leave those lines unconnected. The RW pin can be tied to ground instead of connected to a pin on the Arduino; if so, omit it from this function's parameters. | ||
| + | ===== Syntax ===== | ||
| + | <code> | ||
| + | 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) | ||
| + | </code> | ||
| + | ===== Parameters ===== | ||
| + | |||
| + | rs: the number of the Arduino pin that is connected to the RS pin on the LCD | ||
| + | |||
| + | rw: the number of the Arduino pin that is connected to the RW pin on the LCD (optional) | ||
| + | |||
| + | enable: the number of the Arduino pin that is connected to the enable pin on the LCD | ||
| + | |||
| + | d0, d1, d2, d3, d4, d5, d6, d7: the numbers of the Arduino pins that are connected to the corresponding data pins on the LCD. d0, d1, d2, and d3 are optional; if omitted, the LCD will be controlled using only the four data lines (d4, d5, d6, d7). | ||
| + | ===== Example ===== | ||
| + | <code cpp> | ||
| + | #include <LiquidCrystal.h> | ||
| + | |||
| + | LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2); | ||
| + | |||
| + | void setup() | ||
| + | { | ||
| + | lcd.print("hello, world!"); | ||
| + | } | ||
| + | |||
| + | void loop() {} | ||
| + | </code> | ||
| + | |||
| + | [[en:arduino:libraries|Reference Home]] | ||