YFROBOT创客社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 108947|回复: 93
打印 上一主题 下一主题

Arduino驱动IIC/I2C LCD1602模块显示(4根线解决连接)

  [复制链接]

签到天数: 1 天

[LV.1]初来乍到

楼主
发表于 2016-4-16 22:17:19 | 显示全部楼层


有的板上是AREF也是5V能点亮,但程序没反映,要重新接VCC5V,望借鉴!
回复 支持 1 反对 0

使用道具 举报

签到天数: 1 天

[LV.1]初来乍到

沙发
发表于 2016-4-17 21:02:35 | 显示全部楼层
#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
}
回复 支持 反对

使用道具 举报

签到天数: 1 天

[LV.1]初来乍到

板凳
发表于 2016-4-17 21:07:30 | 显示全部楼层
本帖最后由 AllBlue 于 2016-4-23 08:26 编辑



这段是检测IC2设备端口的程序,结果在串口监视器里看,没有发现就是设备连接有问题

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 支持 1 反对 0

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|联系我们|YFROBOT ( 苏ICP备20009901号-2  

GMT+8, 2024-5-4 10:56 , Processed in 0.048580 second(s), 28 queries .

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表