This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Scan I2C bus on Arduino hardware for device address


addr = scanI2CBus(a,bus)



addr = scanI2CBus(a,bus) scans the specified bus on the Arduino® hardware in object a and stores it in the variable addr.


collapse all

Create a connection to an Arduino Due and scan the specified bus number. You can specify bus 1 only if you are using Arduino Due boards.

a = arduino('COM5','Due','Libraries','I2C');
ans = 1×1 cell array

Input Arguments

collapse all

Arduino hardware connection created using arduino, specified as an object.

I2C bus number specified as a number.

Output Arguments

collapse all

I2C bus address returned as a character vector or a cell array of character vectors.

Introduced in R2014b