Correct program can be uploaded, lcd can not be displayed


i used same piece of lcd can displayed same program, 1 not show there problem lcd? program ensure correct, lcd not know problem appears?


my program

#include <wire.h>  // arduino ide 內建
// lcd i2c library,從這裡可以下載:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
#include <liquidcrystal_i2c.h>

// set pins on i2c chip used lcd connections:
//                    addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
liquidcrystal_i2c lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, positive);  // 設定 lcd i2c 位址

void setup() {
 serial.begin(115200);  // 用於手動輸入文字
 lcd.begin(16, 2);      // 初始化 lcd,一行 16 的字元,共 2 行,預設開啟背光

 // 閃爍三次
 for(int = 0; < 3; i++) {
   lcd.backlight(); // 開啟背光
   delay(250);
   lcd.nobacklight(); // 關閉背光
   delay(250);
 }
 lcd.backlight();

 // 輸出初始化文字
 lcd.setcursor(0, 0); // 設定游標位置在第一行行首
 lcd.print("hello, world!");
 delay(1000);
 lcd.setcursor(0, 1); // 設定游標位置在第二行行首
 lcd.print("gtwang.org");
 delay(8000);

 // 告知使用者可以開始手動輸入訊息
 lcd.clear();
 lcd.setcursor(0, 0);
 lcd.print("use serial mon");
 lcd.setcursor(0, 1);
 lcd.print("type display");
}

void loop() {
 // 當使用者手動輸入訊息
 if (serial.available()) {
   // 等待一小段時間,確認資料都接收下來了
   delay(100);
   // 清除舊訊息
   lcd.clear();
   // 讀取新訊息
   while (serial.available() > 0) {
     // 將訊息顯示在 lcd 上
     lcd.write(serial.read());
   }
 }
}

maybe display set alternate address

liquidcrystal_i2c lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, positive);  // 設定 lcd i2c 位址

try

liquidcrystal_i2c lcd(0x3f, 2, 1, 0, 4, 5, 6, 7, 3, positive);  // 設定 lcd i2c 位址


Arduino Forum > Using Arduino > Displays > Correct program can be uploaded, lcd can not be displayed


arduino

Comments

Popular posts from this blog

Error compiling for board Arduino/Genuino Uno.

Installation database is corrupt

esp8266 (nodemcu 0.9) client.write très lent ???