Wednesday, May 11, 2016

i2cdetect library - Arduino library to I2C bus for devices.

mcauser/i2cdetect is a Arduino library for scanning I2C bus for devices. Outputs a table similar to the linux program (i2cdetect - detect I2C chips) of the same name.

- Add i2cdetect library:
Open Library Manager (Sketch > Include Library > Manager Libraries...) to install i2cdetect library

- Open i2cdetect example (File > Examples > i2cdetect > i2cdetect)

#include <Wire.h>
#include <i2cdetect.h>

void setup() {
  Serial.println("i2cdetect example\n");
  Serial.print("Scanning address range 0x03-0x77\n\n");

void loop() {
  i2cdetect();  // default range from 0x03 to 0x77

Output example to shown a I2C device with address 0x27 is connected.
- Run on Arduino Uno
- A4 (SDA), A5 (SCL)

No comments:

Post a Comment