I2C SCANNER

Код:
#include 
#include 
#include 
#include 

#define BuzzerPin   15
#define OLED_RESET  24
#define OLED_DC     26
#define OLED_CS     31
Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);

void setup()
{
  Wire.begin();
  display.begin(SSD1306_SWITCHCAPVCC);
  display.clearDisplay();
}

void loop()
{
  byte error, address;
  int nDevices;
  display.setTextSize(0);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println("Scanning...");

  nDevices = 0;
  for (address = 1; address < 127; address++ )
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      display.print("I2C device found 0x");
      if (address < 16)
        display.print("0");
      display.println(address, HEX);
      nDevices++;
    }
    else if (error == 4)
    {
      display.print("Unknown error at address 0x");
      if (address < 16)
        display.print("0");
      display.println(address, HEX);
    }
  }
  if (nDevices == 0)
    display.println("No I2C devices found");
  else
    display.println("done");
  display.display();
  delay(5000);           // wait 5 seconds for next scan
  display.clearDisplay();
}