Got a device connected to your Arduino and want to confirm what the address is? This code snippet (written for an Uno) gives you the I2C addresses that respond with an ACK on your I2C bus. I can't remember how I ended up with this code. I might have copied key portions from someone but I can't remember. If I did, thanks
/*
 I2C Address Finder
 Runs through I2C addresses once from 0x00 to 0x7F looking for an acknowledge
 Lists all addresses that were found on the bus
*/
#include <Wire.h>
void setup()
{
 // PIN SETUP
 pinMode(A4, INPUT);   // define as input for now, will get redifined by I2C functions
 pinMode(A5, INPUT);   // define as input for now, will get redifined by I2C functions
Â
 Serial.begin(115200);
 printTimestamp();
 Serial.println("I2C Address Finder Running");
Â
 Wire.begin();
Â
 byte endTXreturnedValue, loopCounter = 0;
Â
 for(loopCounter=0; loopCounter<=127; loopCounter++)
 {
  printTimestamp();
  Serial.print("Starting I2C write to address ");
  Serial.println(loopCounter, HEX);
  Wire.beginTransmission(loopCounter);
  printTimestamp();
  endTXreturnedValue = Wire.endTransmission();
 Â
  if (endTXreturnedValue == 0)
  {
   Serial.print("Correct address is = ");
   Serial.println(loopCounter, HEX);
  }
 Â
 }
 Â
}
void loop()
{
Â
 // nothing in here, runs only once
 Â
}
void printTimestamp (void)
{
 Serial.print("[");
 Serial.print(millis());
 Serial.print("]");
}