#include <Wire.h> //include Wire.h library
void setup()
{
Wire.begin(); // Wire communication begin
Serial.begin(9600); // The baudrate of Serial monitor is set in 9600
while (!Serial); // Waiting for Serial Monitor
Serial.println(“\nI2C Scanner”);
}
void loop()
{
byte error, address; //variable for error and I2C address
int nDevices;
int sp=1000;
int n[8] = {8,18,28,38,48,58,68,78};
Serial.println(“Scanning…0x08”);
//Wire.beginTransmission((uint8_t)0x08);
Wire.beginTransmission(8);
error = Wire.endTransmission();
Serial.print(“error=”);
Serial.println(error);
delay(sp); // wait 5 seconds for the next I2C scan
Serial.println(“Scanning…0x18”);
// Wire.beginTransmission((uint8_t)0x18);
Wire.beginTransmission(24);
error = Wire.endTransmission();
Serial.print(“error=”);
Serial.println(error);
delay(sp); // wait 5 seconds for the next I2C scan
Serial.println(“Scanning…0x28”);
//Wire.beginTransmission((uint8_t)0x28);
Wire.beginTransmission(40);
error = Wire.endTransmission();
Serial.print(“error=”);
Serial.println(error);
delay(sp); // wait 5 seconds for the next I2C scan
Serial.println(“Scanning…0x38”);
//Wire.beginTransmission((uint8_t)0x38);
Wire.beginTransmission(56);
error = Wire.endTransmission();
Serial.print(“error=”);
Serial.println(error);
delay(sp); // wait 5 seconds for the next I2C scan
Serial.println(“Scanning…0x48”);
//Wire.beginTransmission((uint8_t)0x48);
Wire.beginTransmission(72);
error = Wire.endTransmission();
Serial.print(“error=”);
Serial.println(error);
delay(sp); // wait 5 seconds for the next I2C scan
Serial.println(“Scanning…0x58”);
//Wire.beginTransmission((uint8_t)0x58);
Wire.beginTransmission(88);
error = Wire.endTransmission();
Serial.print(“error=”);
Serial.println(error);
delay(sp); // wait 5 seconds for the next I2C scan
Serial.println(“Scanning…0x68”);
//Wire.beginTransmission((uint8_t)0x68);
Wire.beginTransmission(104);
error = Wire.endTransmission();
Serial.print(“error=”);
Serial.println(error);
delay(sp); // wait 5 seconds for the next I2C scan
Serial.println(“Scanning…0x78”);
// Wire.beginTransmission((uint8_t)0x78);
Wire.beginTransmission(120);
error = Wire.endTransmission();
Serial.print(“error=”);
Serial.println(error);
delay(5000); // wait 5 seconds for the next I2C scan
}