久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索

【Arduino】108種傳感器模塊系列實(shí)驗(yàn)(134)---2004A LCD液晶屏

查看數(shù): 3897 | 評(píng)論數(shù): 32 | 收藏 0
關(guān)燈 | 提示:支持鍵盤(pán)翻頁(yè)<-左 右->
    組圖打開(kāi)中,請(qǐng)稍候......
發(fā)布時(shí)間: 2019-9-22 16:25

正文摘要:

37款傳感器與模塊的提法,在網(wǎng)絡(luò)上廣泛流傳,其實(shí)Arduino能夠兼容的傳感器模塊肯定是不止37種的。鑒于本人手頭積累了一些傳感器和模塊,依照實(shí)踐出真知(一定要?jiǎng)邮肿觯┑睦砟,以學(xué)習(xí)和交流為目的,這里準(zhǔn)備逐一動(dòng) ...

回復(fù)

ID:513258 發(fā)表于 2020-11-29 11:17
  1. /*
  2.   【Arduino】108種傳感器模塊系列實(shí)驗(yàn)(資料+代碼+圖形+仿真)
  3.   實(shí)驗(yàn)一百三十四:2004A字符顯示液晶模塊LCD/LCM 藍(lán)屏5V(帶背光 IIC/I2C)
  4.   安裝庫(kù):工具——管理庫(kù)——搜索“LiquidCrystal_I2C"——下載安裝
  5.   項(xiàng)目三:多重顯示字符,系列演示
  6.   Arduino------LCD2004A
  7.   5V-------------VCC
  8.   GND-----------GND
  9.   A4-----------SDA IIC 數(shù)據(jù)線(xiàn)
  10.   A5-----------SCL IIC 時(shí)鐘線(xiàn)
  11. */

  12. #include <Wire.h>
  13. #include <LiquidCrystal_I2C.h>

  14. #if defined(ARDUINO) && ARDUINO >= 100
  15. #define printByte(args)  write(args);
  16. #else
  17. #define printByte(args)  print(args,BYTE);
  18. #endif

  19. uint8_t bell[8]  = {0x4, 0xe, 0xe, 0xe, 0x1f, 0x0, 0x4};
  20. uint8_t note[8]  = {0x2, 0x3, 0x2, 0xe, 0x1e, 0xc, 0x0};
  21. uint8_t clock[8] = {0x0, 0xe, 0x15, 0x17, 0x11, 0xe, 0x0};
  22. uint8_t heart[8] = {0x0, 0xa, 0x1f, 0x1f, 0xe, 0x4, 0x0};
  23. uint8_t duck[8]  = {0x0, 0xc, 0x1d, 0xf, 0xf, 0x6, 0x0};
  24. uint8_t check[8] = {0x0, 0x1, 0x3, 0x16, 0x1c, 0x8, 0x0};
  25. uint8_t cross[8] = {0x0, 0x1b, 0xe, 0x4, 0xe, 0x1b, 0x0};
  26. uint8_t retarrow[8] = {        0x1, 0x1, 0x5, 0x9, 0x1f, 0x8, 0x4};

  27. LiquidCrystal_I2C lcd(0x27, 20, 4); // set the LCD address to 0x27 for a 16 chars and 2 line display

  28. void setup()
  29. {
  30.   lcd.init();                      // initialize the lcd
  31.   lcd.backlight();

  32.   lcd.createChar(0, bell);
  33.   lcd.createChar(1, note);
  34.   lcd.createChar(2, clock);
  35.   lcd.createChar(3, heart);
  36.   lcd.createChar(4, duck);
  37.   lcd.createChar(5, check);
  38.   lcd.createChar(6, cross);
  39.   lcd.createChar(7, retarrow);
  40.   lcd.home();

  41.   lcd.print("Hello world...");
  42.   lcd.setCursor(0, 1);
  43.   lcd.print(" i ");
  44.   lcd.printByte(3);
  45.   lcd.print(" arduinos!");
  46.   delay(5000);
  47.   displayKeyCodes();

  48. }

  49. // display all keycodes
  50. void displayKeyCodes(void) {
  51.   uint8_t i = 0;
  52.   while (1) {
  53.     lcd.clear();
  54.     lcd.print("Codes 0x"); lcd.print(i, HEX);
  55.     lcd.print("-0x"); lcd.print(i + 16, HEX);
  56.     lcd.setCursor(0, 1);
  57.     for (int j = 0; j < 16; j++) {
  58.       lcd.printByte(i + j);
  59.     }
  60.     i += 16;

  61.     delay(4000);
  62.   }
  63. }

  64. void loop()
  65. {

  66. }
復(fù)制代碼


ID:513258 發(fā)表于 2020-11-29 11:15
  1. /*
  2.   【Arduino】108種傳感器模塊系列實(shí)驗(yàn)(資料+代碼+圖形+仿真)
  3.   實(shí)驗(yàn)一百三十四:2004A字符顯示液晶模塊LCD/LCM 藍(lán)屏5V(帶背光 IIC/I2C)
  4.   安裝庫(kù):工具——管理庫(kù)——搜索“LiquidCrystal_I2C"——下載安裝
  5.   項(xiàng)目二:顯示字符“Welcome to Eagler8”
  6.   Arduino------LCD2004A
  7.   5V-------------VCC
  8.   GND-----------GND
  9.   A4-----------SDA IIC 數(shù)據(jù)線(xiàn)
  10.   A5-----------SCL  IIC 時(shí)鐘線(xiàn)
  11. */

  12. #include <Wire.h>
  13. #include <LiquidCrystal_I2C.h>
  14. LiquidCrystal_I2C lcd(0x27, 20, 4);

  15. void MyPrintLCD(String MyString)
  16. {
  17.   for (int i = 0; i < MyString.length(); i++)
  18.     lcd.write(MyString.charAt(i));
  19. }

  20. void setup()
  21. {
  22.   lcd.init();
  23.   lcd.backlight();
  24.   MyPrintLCD(" Welcome to ");
  25.   lcd.setCursor(0, 2);
  26.   MyPrintLCD("           Eagler8");
  27. }

  28. void loop()
  29. {
  30. }
復(fù)制代碼


ID:513258 發(fā)表于 2020-11-29 11:11
  1. /*
  2. 【Arduino】108種傳感器模塊系列實(shí)驗(yàn)(資料+代碼+圖形+仿真)
  3. 實(shí)驗(yàn)一百三十四:2004A字符顯示液晶模塊LCD/LCM 藍(lán)屏5V(帶背光 IIC/I2C)
  4. 項(xiàng)目一:尋找查詢(xún)?cè)O(shè)備IIC地址,在串口上即可看到2004A的地址
  5. 這里查詢(xún)結(jié)果是“0x27”(這個(gè)地址不對(duì)的話(huà),實(shí)測(cè)無(wú)法燒錄程序)
  6. Arduino------LCD2004A
  7. 5V-------------VCC
  8. GND-----------GND
  9. A4-----------SDA IIC 數(shù)據(jù)線(xiàn)
  10. A5-----------SCL  IIC 時(shí)鐘線(xiàn)
  11. */

  12. #include <Wire.h>

  13. void setup(){
  14.   Wire.begin();
  15.   Serial.begin(9600);
  16.   Serial.println("\nI2C Scanner");
  17. }
  18. void loop(){
  19.   byte error, address;
  20.   int nDevices;
  21.   Serial.println("Eagler8 Scanning...");
  22.   nDevices = 0;
  23.   for (address = 1; address < 127; address++ ){
  24.    
  25.     Wire.beginTransmission(address);
  26.     error = Wire.endTransmission();
  27.     if (error == 0){
  28.       Serial.print("I2C device found at address 0x");
  29.       if (address < 16)
  30.         Serial.print("0");
  31.       Serial.print(address, HEX);
  32.       Serial.println(" !");
  33.       nDevices++;
  34.     }else if (error == 4){
  35.       Serial.print("Unknow error at address 0x");
  36.       if (address < 16)
  37.         Serial.print("0");
  38.       Serial.println(address, HEX);
  39.     }
  40.   }
  41.   if (nDevices == 0)
  42.     Serial.println("No I2C devices found\n");
  43.   else
  44.     Serial.println("done\n");
  45.   delay(5000);
  46. }
復(fù)制代碼


ID:513258 發(fā)表于 2020-11-29 10:28

謝謝鼓勵(lì),有空多交流
ID:850818 發(fā)表于 2020-11-28 18:01
求大神帶路
ID:513258 發(fā)表于 2020-11-28 17:50
huwu006 發(fā)表于 2020-11-28 09:32
模有,實(shí)例如何下

不好意思,手頭事多,還沒(méi)有空做這個(gè)實(shí)驗(yàn)
ID:850532 發(fā)表于 2020-11-28 09:32
模有,實(shí)例如何下
ID:850532 發(fā)表于 2020-11-28 09:31
有代碼嗎

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 一区二区视频 | 日韩在线免费看 | av一区二区三区 | 日韩午夜网站 | 一区二区三区在线 | 欧 | 网站黄色在线 | 国产在线视频在线观看 | 中文字幕在线精品 | 欧美日韩在线一区二区 | 97国产精品视频 | www视频在线观看 | 亚洲激情网站 | av手机免费在线观看 | 91久久综合亚洲鲁鲁五月天 | 国产亚洲一区二区精品 | 国产免费高清 | 国产精品久久久久久久久久久免费看 | 一级在线视频 | 国产精品国产成人国产三级 | 91精品国产乱码久久久久久 | 成人国产精品久久久 | 日本三级日产三级国产三级 | 伊人春色成人网 | 国产精品久久久久久影院8一贰佰 | 成人1区| 欧美精品欧美精品系列 | 精品欧美一区免费观看α√ | 欧美九九| 国产精品久久国产精品久久 | 日韩精品一区二区三区在线观看 | 亚洲性人人天天夜夜摸 | 毛片久久久 | 欧美久久一区二区三区 | 国产97在线视频 | 亚洲精品www.| 欧美中文字幕一区二区三区 | 日韩精品 | 国产精品爱久久久久久久 | 国产精品爱久久久久久久 | 色久在线| 一区二区精品 |