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:
Page last edited March 08, 2024
Text editor powered by tinymce.