This Arduino I2C scanner sketch uses the Adafruit TestBed library. This library takes care of a lot of the board specific boiler plate setup, so should be able to be used as is on most platforms.

To use, first install the Adafruit TestBed library using the Arduino Library Manager:

Tools > Manage Libraries...

Search for "testbed" to find the library and then click Install.

Then the I2C scanner can be found in the library examples.

File > Examples > Adafruit TestBed > I2C_Scan

Once the sketch is uploaded to the board, open the Arduino Serial Monitor to see the scan results.

Scan Results

The board's primary I2C port, aka Wire, will be scanned. Additionally, if a secondary I2C port, aka Wire1, exists for the board, then it will also be scanned.

Here is example output for a board with two I2C ports, with a single I2C device attached to each:

This guide was first published on Sep 16, 2021. It was last updated on 2022-05-31 20:37:12 -0400.

This page (Arduino Using TestBed) was last updated on Jul 22, 2022.

Text editor powered by tinymce.