参考:http://henrysbench.capnfatz.com/henrys-bench/arduino-projects-tips-and-more/arduino-quick-tip-find-your-i2c-address/

Arduino Quick Tip:  Find Your I2C Address

Don’t Get Hung Up When You Want to Play

You’ve just received your new module and you want to test it.  You go back the seller’s web page and find instructions that are only slightly clearer than mud.  In fact, one of things you discover as you attempt to unravel the odd form of English that is used is that you can’t seem to figure out what the I2C address is.

You can certainly find the data sheet for the device that the module is built around. With a little work, you should also be able to  identify the address pins.  Then, with a little probing,  you can identify the address.

In fact, at some point in your project development, it may even become necessary.   Alas,  sometimes you only have a few minutes to play and you just want to see the freaking thing work.

If that describes you, then try running the following sketch.  It will scan I2C possible addresses and report the address of the device that responds.

address of the device that responds.

.HenryBenchResponsive { width: 320px; height: 100px }
@media (min-width: 800px) { .HenryBenchResponsive { width: 468px; height: 60px } }
@media (min-width: 1125px) { .HenryBenchResponsive { width: 728px; height: 90px } }

I2C Scanner By Nick Gammon

Copy, Paste, Upload and Run!

// I2C Scanner
// Written by Nick Gammon
// Date: 20th April 2011 #include <Wire.h> void setup() {
  Serial.begin (115200);   // Leonardo: wait for serial port to connect
  while (!Serial)
    {
    }   Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  
  Wire.begin();
  for (byte i = 8; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1); // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup void loop() {}

I2C Scanner Results

Run the sketch and you will see a result that looks something like this:

Arduino 寻找I2C地址address的更多相关文章

  1. Arduino通过I2C(PCF8574T)驱动1602LCD

    Arduino中使用I2C通信可直接调用Wire.h库, 这个库允许Arduino链接其他I2C设备, 链接线有两条, 分别是SDA(数据行)和SCI(时钟线). 各型号Arduino的I2C对应引脚 ...

  2. Arduino通过I2C(SSD1306)驱动0.96寸12864OLED

    I2C驱动的128x64 OLED I2C (Inter-Integrated Circuit) 集成电路总线是I2CBus的简称, 是一种串行通信总线, 使用多主从架构. 飞利浦公司在1980年代为 ...

  3. Davinci-DM6467板子-外围器件的I2C地址的疑惑解答

    这篇文即调试标清视频或者说调试TVP5147和ADV7343所使用的程序名称为video_sd_playback_480i_composite 我们用的是合众达公司(SEED)的SEED-DVSD64 ...

  4. 地址(Address)——WCF学习笔记(2)

    地址(Address)分为: 统一资源表示(URI). EndpointAddress. 端口共享. 逻辑地址与物理地址. 请求监听与消息分发.

  5. The three day 给你一个有效的 IPv4 地址 address,返回这个 IP 地址的无效化版本

    """ 给你一个有效的 IPv4 地址 address,返回这个 IP 地址的无效化版本. 所谓无效化 IP 地址,其实就是用 "[.]" 代替了每个 ...

  6. 通过PEB寻找函数地址

      通过PEB的Ldr参数(结构体定义为_PEB_LDR_DATA),遍历当前进程加载的模块信息链表,找到目标模块.   摘自PEB LDR DATA: typedef struct _PEB_LDR ...

  7. 第2章地址Address(WCF全面解析3)

    WCF顾明思义,就是在Windows平台下解决通信(C,Communication)的基础框架(F,Foundation)问题. 终结点是WCF最为核心的对象,因为它承载了所有通信功能.服务通过相应的 ...

  8. 23.实现一个名为Person的类和它的子类Employee,Employee有两个子类Faculty 和Staff。 具体要求如下: (1)Person类中的属性有:姓名name(String类型),地址address(String类型), 电话号码telphone(String类型)和电子邮件地址email(String类型); (2)Employee类中的属性有:办公室office(Stri

    package banking; public class Person { private String name; public String address; public String tel ...

  9. 地址(Address)——统一资源表示(URI)——WCF学习笔记(2)

    统一资源标识(URI) URI:Uniform Resource Identifier(统一资源标识),唯一地标识一个网络资源的同时也表示资源所处的位置的方式(资源访问所用的网络协议). URI结构: ...

随机推荐

  1. python小白入门基础(一:注释)

    # 注释:就是对代码的解释,方便大家阅读代码.注释后的代码程序不会执行.# 注释的分类:单行注释和多行注释# (1)单行注释# 在代码前面加个#字符print("hello world&qu ...

  2. H5简单内容

    1.简单认识H5 HTML5不仅仅是作为HTML标记语言的一个最新版本,更重要的是它指定了Web开发的一系列标准,成为第一个将Web作为应用开发平台的HTML语言. 我们日常讨论的H5其实是有一个泛称 ...

  3. Java线程本质

    java当中的线程和操作系统的线程是什么关系? 关于操作系统的线程 linux操作系统的线程控制原语 int pthread create(pthread t *thread, const pthre ...

  4. h5内嵌微信小程序,调用微信支付功能

    在小程序中不能使用之前在浏览器中配置的支付功能,只能调用小程序专属的api进行支付. 因为需要在现在实现的基础上,再添加在小程序中调用微信支付功能,所以我的思路是这样的 1.在点击支付按钮时,判断是不 ...

  5. Mybatis-多对一和一对多

    多对一和一对多 目录 多对一和一对多 1. 复杂表的构建 2. 测试环境搭建 1. 导入Lombok 2. 新建实体类 3. 建立Mapper接口 4. 建立Mapper.xml文件 5. 在核心配置 ...

  6. Apache2.4 下载和安装 - Win10

    Apache安装包已放入百度网盘,链接地址在本文最后 1.下载Windows版本的Apahce安装包 a. 访问官网,进入下载页面 https://www.apachelounge.com (apac ...

  7. Solr专题(一)手把手教你搭建Solr服务

    一.Solr是什么,能解决什么问题? Solr是一个高性能,采用Java开发,基于Lucene的全文搜索服务器.同时对其进行了扩展,提供了比Lucene更为丰富的查询语言,同时实现了可配置.可扩展并对 ...

  8. python操作从数据库中获取数据的接口

    1.输入一个表名,获取表里面的数据 2.判断用户是否存在,如果不存在就添加到数据库里面

  9. Mysql查看最大连接,修改

    1.查看最大连接量 show variables like '%max_connections%'; 2.修改最大连接量 //修改完记得重启 set GLOBAL max_connections = ...

  10. redis-port支持前缀迁移

    一.介绍 redis-port是一款redis数据迁移工具,用来将数据从一个redis迁移到另一个redis实例/redis集群中 ,以下是官方地址: https://github.com/Codis ...