#include <Wire.h>
#define SDA_0 21
#define SCL_0 22
#define I2C_Freq 100000
TwoWire I2C_0 = TwoWire(0);
void setup() {
Serial.begin(115200);
I2C_0.begin(SDA_0, SCL_0, I2C_Freq);
}
void loop() {
Serial.println("Scanning...");
int nDevices = 0;
for (byte address = 1; address < 127; address++) {
I2C_0.beginTransmission(address);
if (I2C_0.endTransmission() == 0) {
Serial.print("I2C device found at address 0x");
Serial.println(address, HEX);
nDevices++;
}
}
if (nDevices == 0) Serial.println("No I2C devices found");
Serial.println("Done\n");
delay(5000);
}