gpt4 book ai didi

c - Arduino 在 Sparkfun 2x16 LCD 上滚动

转载 作者:行者123 更新时间:2023-11-30 17:59:00 26 4
gpt4 key购买 nike

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

最佳答案

您尚未表明您是尝试水平滚动还是垂直滚动。

水平滚动是 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 行。

关于c - Arduino 在 Sparkfun 2x16 LCD 上滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11856409/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com