0

当我想显示大于 32 个字符的内容时。我想让 LCD 滚动,我已经尝试过命令标志0x10,有人能指出我正确的方向吗?

4

1 回答 1

0

您还没有指出您是尝试水平滚动还是垂直滚动。

水平滚动在 lcd 库中是原生的。使用自动滚动或 scrollDisplayLeft/Right

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16,2);
 }

void loop() {

// set the cursor to (16,1):
lcd.setCursor(16,1);
// set the display to automatically scroll:
lcd.autoscroll();
// print from 0 to 9:
for (int thisChar = 0; thisChar < 10; thisChar++) {
 lcd.print(thisChar);
 delay(500);
}
// turn off automatic scrolling
lcd.noAutoscroll();

// clear screen for the next loop:
lcd.clear();
}

对于垂直滚动,您需要手动创建一个操作,将文本从第 2 行复制到第 1 行,并用新文本填充第 2 行。

于 2012-11-28T12:01:19.307 回答