scanI2CBus
Scan I2C bus on Arduino hardware for device address
Syntax
Description
Examples
Scan I2C Bus 1 on Arduino Hardware
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'); scanI2CBus(a,1)
ans = 1×1 cell array
{'0x48'}
Input Arguments
a
— Arduino hardware connection
object
Arduino hardware connection created using arduino
,
specified as an object.
bus
— I2C bus number
0 (default) | numeric
I2C bus number specified as a number.
Output Arguments
addr
— I2C bus address
character vector
I2C bus address returned as a character vector or a cell array of character vectors.
Note
For more details on creating the I2C device
object using address returned by
the scanI2CBus
function on Bus 1 on the
Arduino Due board, ArduinoBLE, and, ArduinoBLE Sense, see Board Specific Issues, .
Version History
Introduced in R2014b
Ouvrir l'exemple
Vous possédez une version modifiée de cet exemple. Souhaitez-vous ouvrir cet exemple avec vos modifications ?
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)