i2c_address_detect.ino 456 B

12345678910111213141516171819202122
  1. #include <Adafruit_I2CDevice.h>
  2. Adafruit_I2CDevice i2c_dev = Adafruit_I2CDevice(0x10);
  3. void setup() {
  4. while (!Serial) { delay(10); }
  5. Serial.begin(115200);
  6. Serial.println("I2C address detection test");
  7. if (!i2c_dev.begin()) {
  8. Serial.print("Did not find device at 0x");
  9. Serial.println(i2c_dev.address(), HEX);
  10. while (1);
  11. }
  12. Serial.print("Device found on address 0x");
  13. Serial.println(i2c_dev.address(), HEX);
  14. }
  15. void loop() {
  16. }