Skip to content

getDeviceAddress()

Arnd edited this page Feb 9, 2019 · 1 revision

getDeviceAddress([deviceNumber]);

This function returns the I2C address of "deviceNumber".


Example:

INA_Class INA(); // Instantiate the class
void setup() {
  uint8_t deviceCount = INA.begin(10,100000); // 10 Amp Maximum bus with a shunt resistor of 0.1 Ohm
  Serial.print("Found ");
  Serial.print(deviceCount); 
  Serial.println(" INA2xx devices");
  for (uint8_t i=0;i<deviceCount;i++) {
     Serial.print("Device ");
     Serial.print(i);
     Serial.print(" is at address ");
     Serial.print(INA.getDeviceAddress(i));
     Serial.print(" (0x");
     Serial.print(INA.getDeviceAddress(i),HEX);
     Serial.println(")");
  } // of for-next all devices     
} // of setup
void loop() {
  // code Comes here
} // of main loop