i2C 1602 [ LCD1602转接板 Arduino IIC ]没显示一例
一般情况下,默认用库就可以了但也有不显示的情况,例如只有一行显示黑框~~
果断就是i2C地址错了,不是默认的0x27
于是乎,找到正确的地址就是关键了
来自百度大神的提供:
http://tieba.baidu.com/p/2465553311
#include <Wire.h>
void setup()
{
Wire.begin();
Serial.begin(9600);
Serial.println("\nI2C Scanner");
}
void loop()
{
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
Serial.print("I2C device found at address 0x");
if (address<16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
}
else if (error==4)
{
Serial.print("Unknow error at address 0x");
if (address<16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
delay(5000); // wait 5 seconds for next scan
}
地址扫描出来后,修改正确的地址即可,比如我买的1602转i2c
4个,有3个是0x27,余下一个是 0x3F(标准程序必然运行不起来),尼玛,坑爹啊
PS:转接板是个好东西,4元不到,加上普通的1602,就成了i2C的了~~~
PS2:这个转接板看测试程序,目测还带字库,艾玛,这是赚了的节奏?
问个问题呀,问什么我的1602 I2C 只是蓝屏连黑框都没有啊 看pdf,貌似不带字库。 不带字库的,就是节约端口 感谢,我从淘宝上买的3个都用起来了 谢谢!这份资料很宝贵!让我中I2C中明白了过来,显示方式有2种模式! 我以前程序就按0x27来的,不行。用你给的程序得出来是0x20,改了后还是第一行黑框啊,您知道问题还会出在哪里么?
毒师老白 发表于 2015-1-15 15:24 static/image/common/back.gif
我以前程序就按0x27来的,不行。用你给的程序得出来是0x20,改了后还是第一行黑框啊,您知道问题还会出在哪里 ...
你好 你的问题解决了么 我的一直是一个亮条 小杰 发表于 2015-1-26 21:39 static/image/common/back.gif
你好 你的问题解决了么 我的一直是一个亮条
解决了,是库的问题
这个简单。代码:
//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#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()
{
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.print("Hello, world!");
}
void loop()
{
} 我买了2个,地址都是0X3F的,到目前为止,都4天了,网上能见到的办法都用过了,依然是一行黑方块,请问楼主,你0X3F的能用吗?另外,说的库的问题,是值得什么问题呢?
bzbyr 发表于 2016-7-9 21:09 static/image/common/back.gif
问个问题呀,问什么我的1602 I2C 只是蓝屏连黑框都没有啊
没黑框说明了对比度不对,可以调背面的可调电阻 例程只有第一行输出,
如何让1602第二行输出呢?
谢谢 找到了 不好意思 谢谢大家 大侠们好,请问如何清零?
谢谢了。
页:
[1]
2