参考: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. Java 获取一段时间内的每一天

    有时候我们会遇到一些业务场景,需要去获取一段时间内的每一天日期 public static List<Date> findDates(Date dBegin, Date dEnd) { L ...

  2. 关于action的使用在firefox报错的问题

    现在的网站有很多都是鼠标移到上面去才会显示出相应的一些标签之类的东西,然后再进行操作,但是因为要操作的元素一开始是隐藏的,就没办法直接定位,只能调用action来模拟鼠标悬停操作,也就是下面这句代码: ...

  3. 认证授权:IdentityServer4

    前言 上一篇文章<学习OIDC>介绍了OIDC协议,本篇开始我们就来具体来学习OIDC的具体实现IdentityServer4 学习. 一.IdentityServer4 是什么? Ide ...

  4. Azure Blob (三)参数设置说明

    一,引言 上一篇将 Azure Blob 存储的时候,有使用到一个 .NET  Core Web 项目,通过代码的方式进行操作 Azure Blob 的数据,接着上一篇的内容,今天继续看一下代码,具体 ...

  5. 上传文件到服务器指定位置 & 从服务器指定位置下载文件

    需要的jar包: 去maven仓库自己搜索com.jcraft下载jar包 <dependency> <groupId>com.jcraft</groupId> & ...

  6. spring cloud 通过zuul网关去请求的时候报404的几个原因。

    spring cloud 中 zuul 网关的那些坑: 1.检查你的服务是否正常启动. 2.检查你的服务是否正常注册到注册中心. 3.zuul网关的路由规则是会把你注册在注册中心的serviceId ...

  7. 如何编写一个简单的Linux驱动(二)——设备操作集file_operations

    前期知识 如何编写一个简单的Linux驱动(一)--驱动的基本框架 前言 在上一篇文章中,我们学习了驱动的基本框架.这一章,我们会在上一章代码的基础上,继续对驱动的框架进行完善.要下载上一篇文章的全部 ...

  8. [翻译] 发布双屏预览SKD,公布MICROSOFT 365开发者日日期

    [前置提示]:本文翻译工作尚未完工,您可以先看原文QUQ 原文标题:Announcing dual-screen preview SDKs and Microsoft 365 Developer Da ...

  9. oracle数据处理之sql*loader(一)

    SQL*Loader是oracle提供的可以从多种平面文件中向数据库中加载数据的工具,它比较适合业务分析类型数据库(数据仓库);使用sqlldr工具可以在很短的时间内向数据库中加载大量的数据,像把制作 ...

  10. CentOS7重装yum和python

    卸载现有的Python和Yum 1.删除现有Python ##强制删除已安装程序及其关联 rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps ...