Arduino 寻找I2C地址address
参考: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
Contents [show]
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的更多相关文章
- Arduino通过I2C(PCF8574T)驱动1602LCD
Arduino中使用I2C通信可直接调用Wire.h库, 这个库允许Arduino链接其他I2C设备, 链接线有两条, 分别是SDA(数据行)和SCI(时钟线). 各型号Arduino的I2C对应引脚 ...
- Arduino通过I2C(SSD1306)驱动0.96寸12864OLED
I2C驱动的128x64 OLED I2C (Inter-Integrated Circuit) 集成电路总线是I2CBus的简称, 是一种串行通信总线, 使用多主从架构. 飞利浦公司在1980年代为 ...
- Davinci-DM6467板子-外围器件的I2C地址的疑惑解答
这篇文即调试标清视频或者说调试TVP5147和ADV7343所使用的程序名称为video_sd_playback_480i_composite 我们用的是合众达公司(SEED)的SEED-DVSD64 ...
- 地址(Address)——WCF学习笔记(2)
地址(Address)分为: 统一资源表示(URI). EndpointAddress. 端口共享. 逻辑地址与物理地址. 请求监听与消息分发.
- The three day 给你一个有效的 IPv4 地址 address,返回这个 IP 地址的无效化版本
""" 给你一个有效的 IPv4 地址 address,返回这个 IP 地址的无效化版本. 所谓无效化 IP 地址,其实就是用 "[.]" 代替了每个 ...
- 通过PEB寻找函数地址
通过PEB的Ldr参数(结构体定义为_PEB_LDR_DATA),遍历当前进程加载的模块信息链表,找到目标模块. 摘自PEB LDR DATA: typedef struct _PEB_LDR ...
- 第2章地址Address(WCF全面解析3)
WCF顾明思义,就是在Windows平台下解决通信(C,Communication)的基础框架(F,Foundation)问题. 终结点是WCF最为核心的对象,因为它承载了所有通信功能.服务通过相应的 ...
- 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 ...
- 地址(Address)——统一资源表示(URI)——WCF学习笔记(2)
统一资源标识(URI) URI:Uniform Resource Identifier(统一资源标识),唯一地标识一个网络资源的同时也表示资源所处的位置的方式(资源访问所用的网络协议). URI结构: ...
随机推荐
- 用python爬虫写一个属于自己的彩虹屁生成器!
效果图如下:
- jq cdn地址
百度CDN支持版本2.0.3, 2.0.2, 2.0.1, 2.0.0,1.11.1, 1.10.2, 1.10.1, 1.10.0, 1.9.1, 1.9.0, 1.8.3, 1.8.2, 1.8. ...
- 【API进阶之路】破圈,用一个API代替10人内容团队
摘要:我用一个API代替10人内容团队,一年帮老板省了一百万. 自从学习API以后,我用技术手段相继帮助业务部.市场部解决了不少难题,算是从纯研发破圈发展到了业务端.老板召开业务讨论会的时候也会带上我 ...
- DHCP和NAT
DHCP(dynamic host configuration protocol)用于内网动态分配IP,是一种基于UDP的应用层协议. NAT(net address translation)用于内网 ...
- Lct 动态链接树
通过树链剖分能了解轻重边 Acdreamer 的博客 http://blog.csdn.net/acdreamers/article/details/10591443 然后看杨哲大大的论文,能了解轻重 ...
- 如何建立一个完美的 Python 项目
原文地址:How to set up a perfect Python project 原文作者:Brendan Maginnis 译者:HelloGitHub-丫丫 校对者:HelloGitHub- ...
- C++类重载函数的function和bind使用
在没有C++11的std::function和std::bind之前,我们使用函数指针的方式是五花八门,结构很繁琐难懂.C++11中提供了std::function和std::bind统一了可调用对象 ...
- 剑指 Offer 45. 把数组排成最小的数
题目描述 输入一个非负整数数组,把数组里所有数字拼接起来排成一个数,打印能拼接出的所有数字中最小的一个. 示例 1: 输入: [10,2] 输出: "102" 示例 2: 输入: ...
- C#编辑GridView的Thead
背景 有这样一个需求,需要更改GridView的Thead,即表头.不只是多行表头,而是任意的内容,可能是一段文字,也可能是一个图片,综合网上的一些资料,大致整理出一些做法. 内容 大致有两种方法 第 ...
- oracle之WHERE子句中常用的运算符
WHERE子句中常用的运算符 4.1 运算符及优先级: 算数运算符*,/,+,-, 逻辑运算符not, and ,or 比较运算符 单行比较运算 =,>, >=,<,<=, & ...
