Arduino Toolkit - @arduino/checkI2CAddress


: retval = checkI2CAddress (ar, address)
: retval = checkI2CAddress (ar, address, bus)

Check that an address of given address responds on the I2C bus

Inputs

ar - arduino object connected to a arduino board.

address - I2C address number to check

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

Outputs

retval - boolean value of true if address responds on the I2C bus

Example

 
 # create arduino connection.
 ar = arduino();
 # scan for devices on the I2C bus
 checkI2CAddress (ar)
 # output if a device using that address is attached
 ans =
   1
 
 

See also: arduino, scanI2Cbus.