I2C_Scanner.ino
1 #include <Wire.h> 2 3 void setup() { 4 Serial.begin(115200); 5 while (!Serial); 6 Wire.begin(); 7 8 Serial.println("Scanning I2C devices..."); 9 for (byte address = 1; address < 127; address++) { 10 Wire.beginTransmission(address); 11 if (Wire.endTransmission() == 0) { 12 Serial.print("Found I2C device at 0x"); 13 Serial.println(address, HEX); 14 delay(5); 15 } 16 } 17 } 18 19 void loop() {}