#include <Wire.h>
void setup() {
Serial.begin(115200);
Wire.begin(PB7, PB6); // Blue Pill I2C1
Serial.println("I2C scan start");
}
void loop() {
byte error, address;
int found = 0;
for (address = 1; address < 127; address++) {
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0) {
Serial.print("Found device at 0x");
if (address < 16) Serial.print("0");
Serial.println(address, HEX);
found++;
}
}
if (!found) Serial.println("No I2C devices found");
delay(3000);
}Loading
stm32-bluepill
stm32-bluepill