【seeed红版Arduino uno r3增强板试用体验】LCD1602显示移动文字

  • 辛迪可乐
  • LV5工程师
  • |      2018-04-05 12:58:05
  • 浏览量 1473
  • 回复:0
上一个帖子介绍了使用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();

}
上传到开发板即可看到两行文字移动
  • 0
  • 收藏
  • 举报
  • 分享
我来回复

登录后可评论,请 登录注册

所有回答 数量:0
x
收藏成功!点击 我的收藏 查看收藏的全部帖子