|
楼主 |
发表于 2020-5-2 16:06:03
|
显示全部楼层
3楼程序====······#include <Wire.h>
#include <LiquidCrystal_I2C.h> //引用I2C库
LiquidCrystal_I2C lcd(0x3f,16,2);
void setup()
{
lcd.init(); // 初始化LCD
lcd.backlight(); //设置LCD背景等亮
}
void loop() {
// set the cursor to (0,0):
lcd.setCursor(0, 0);
// print from 0 to 9:
for (int thisChar = 0; thisChar < 10; thisChar++) {
lcd.print(thisChar);
delay(500);
}
// 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();
}
|
|