dongrui1992 发表于 2016-1-22 17:51:36

《求助》关于lcd 1602 i2c

lcd不能自动刷新,借鉴网络上面的程序也是不能刷新,需要调节背后的对比度旋钮才能看到刷新以后的文字
#include<Wire.h>
#include<LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
void setup()
{ lcd.init();
lcd.setCursor(0,0);
lcd.print("www.geeetech.com");
lcd.backlight();
}
void loop()
{
int i;
for(i=0;i<9;i++)
{
lcd.setCursor(0,1);
lcd.print(i);
delay(1000);
}
}

wwwusr 发表于 2016-1-22 18:07:39

我是用写空白的方法“刷新"的。:lol

写空白;
写i;
delay;

循环。。。。。

dongrui1992 发表于 2016-1-22 20:36:17

//dht11 data=pin2
//lcd1602 scl=A5;sda=A4
#include <dht11.h>
dht11 DHT11;
#define DHT11PIN 2
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup() {
Serial.begin (9600);
lcd.init(); // initialize the lcd

lcd.init(); // initialize the lcd

lcd.backlight(); //Open the backlight
}
void loop() {
int t=DHT11.read(DHT11PIN);
Serial.print("Humidity (%): ");
Serial.println((float)DHT11.humidity, 2);
Serial.print("Temperature (oC): ");
Serial.println((float)DHT11.temperature, 2);
// put your main code here, to run repeatedly:
lcd.clear();
delay(2000);
lcd.print("T is :");
lcd.print((float)DHT11.temperature, 2);
lcd.print("C");
lcd.setCursor(0,1);
lcd.print("H is :");
lcd.print((float)DHT11.humidity, 2);
lcd.print("%");delay(2000);

}已经开始怀疑我的lcd有问题了,所有的程序都是不能下一个,从程序下载到arduino板上面开始,lcd
就没有显示,只有转动后面的i2c的调节对比度旋钮才能显示,数据不能刷新
页: [1]
查看完整版本: 《求助》关于lcd 1602 i2c