上一个帖子介绍了使用LCD1602显示静态文字的方法,下面介绍一下使用LCD1602显示两行移动文字的方法第一行文字显示“Cindycoke Using Seeeduino”
第二行文字显示"Free Gifts at
www.ickey.com"
硬件连接和上面一个帖子一样,直接打开Arduino IDE输入下面sketch内容
#include
#include
char array1="Cindycoke Using Seeeduino";
char array2="Free Gifts at www.ickey.com";
int tim = 500;
// initialize the library with the numbers of the interface pins
LiquidCrystal_I2C lcd(0x3f,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup()
{
lcd.init();
lcd.backlight();
}
void loop()
{
lcd.setCursor(15,0);
for (int positionCounter1 = 0; positionCounter1 < 25; positionCounter1++)
{
lcd.scrollDisplayLeft();
lcd.print(array1);
delay(tim);
}
lcd.clear();
lcd.setCursor(15,1);
for (int positionCounter = 0; positionCounter < 27; positionCounter++)
{
lcd.scrollDisplayLeft();
lcd.print(array2);
delay(tim);
}
lcd.clear();
}
上传到开发板即可看到两行文字移动
上一个帖子介绍了使用LCD1602显示静态文字的方法,下面介绍一下使用LCD1602显示两行移动文字的方法第一行文字显示“Cindycoke Using Seeeduino”
第二行文字显示"Free Gifts at
www.ickey.com"
硬件连接和上面一个帖子一样,直接打开Arduino IDE输入下面sketch内容
#include
#include
char array1="Cindycoke Using Seeeduino";
char array2="Free Gifts at www.ickey.com";
int tim = 500;
// initialize the library with the numbers of the interface pins
LiquidCrystal_I2C lcd(0x3f,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup()
{
lcd.init();
lcd.backlight();
}
void loop()
{
lcd.setCursor(15,0);
for (int positionCounter1 = 0; positionCounter1 < 25; positionCounter1++)
{
lcd.scrollDisplayLeft();
lcd.print(array1);
delay(tim);
}
lcd.clear();
lcd.setCursor(15,1);
for (int positionCounter = 0; positionCounter < 27; positionCounter++)
{
lcd.scrollDisplayLeft();
lcd.print(array2);
delay(tim);
}
lcd.clear();
}
上传到开发板即可看到两行文字移动