arduinoprojects

git clone https://git.tarina.org/arduinoprojects
Log | Files | Refs

i2c_address_detect.ino (456B)


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