Arduino Toolkit - scanI2Cbus


: retval = scanI2Cbus (ar)
: retval = scanI2Cbus (ar, bus)

Scan arduino for devices on the I2C bus.

Inputs

ar - arduino object connected to a arduino board.

bus - bus number to scan I2C devices, when multiple buses are available. If the bus is not specified, it will default to 0.

Outputs

retval - cell array of addresses as strings in format of "0xXX".

Example

 
 # create arduino connection.
 ar = arduino();
 # scan for devices on the I2C bus
 scanI2Cbus (ar)
 # output is each detected i2c address as a string
 ans =
 {
  [1,1] = 0x50
 }
 
 

See also: arduino, i2cdev, checkI2CAddress.