欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: arduino使用LiquidCrystal庫在lcd1602上滾動顯示 [打印本頁]

作者: 寄語    時間: 2023-7-28 00:22
標題: arduino使用LiquidCrystal庫在lcd1602上滾動顯示
arduino可以使用liquidcrystal庫再lcd1602上顯示,也可以自行編輯指令顯示,此處使用的是liquidcrystal庫,使用liquidcrystal庫更加簡單明了,自行編輯命令更加復雜,但是自行編輯命令更加有助于對lcd1602的理解。
代碼如下:
#include <LiquidCrystal.h>

// 創建lcd控制對象,并指定其引腳與Arduino控制板對應關系
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

// 定義一個'a'變量
int thisChar = 'a';

void setup()
{
  // lcd初始化,同時設置lcd屏幕的列數和行數(寬和高)
  lcd.begin(16, 2);
  // 打開光標
  lcd.cursor();
}

void loop()
{
  //在'm'處轉向
  if (thisChar == 'm')
  {
    // go right for the next letter
    lcd.rightToLeft();
  }
  // 在's'處再次反轉
  if (thisChar == 's')
  {
    // 向左走到下一個字母
    lcd.leftToRight();
  }
  // 大于'z'則重置
  if (thisChar > 'z')
  {
    // 回到(0,0)位置:
    lcd.home();
    //再次從a開始
    thisChar = 'a';
  }
  // 打印字符
  lcd.write(thisChar);
  // 延時等待一秒
  delay(100);
  // thisChar自增
  thisChar++;
}
proteus接線圖如下:


作者: 寄語    時間: 2023-7-28 00:24
proteus工程和arduino項目分別在兩個包里

arduino_scrolling_show.rar

17.47 KB, 下載次數: 10, 下載積分: 黑幣 -5

Proteus仿真

arduino and lcd1602 scrolling shouw.rar

62.64 KB, 下載次數: 12, 下載積分: 黑幣 -5

程序


作者: 123456poiuytrew    時間: 2024-3-28 15:04
沒有工程
作者: sfls    時間: 2024-8-15 13:19
為什么我的1602不顯示呢?




歡迎光臨 (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1