Arduino i2c address not getting identified.

9 vues (au cours des 30 derniers jours)
Sourabh Karmakar
Sourabh Karmakar le 26 Juil 2022
Hi,
I am using Arduino Due for my project in Matlab 2022a on windows 11. I am using the Arduino engineering kit latest update also. I am getting the following error:
>> a = arduino('COM5', 'Due'),
a =
arduino with properties:
Port: 'COM5'
Board: 'Due'
AvailablePins: {'D2-D53', 'A0-A11'}
AvailableDigitalPins: {'D2-D53', 'A0-A11'}
AvailablePWMPins: {'D2-D13'}
AvailableAnalogPins: {'A0-A11'}
AvailableI2CBusIDs: [0, 1]
AvailableSerialPortIDs: [1, 2, 3]
Libraries: {'I2C'}
Show all properties
>> x = scanI2CBus(a,1)
x =
2×1 cell array
{'0x48'}
{'0x49'}
>> deviceObj = device(a,'I2CAddress','0x49')
Invalid I2C device address '0x49'. Use scanI2CBus for a list of devices detected on an I2C bus.
>> deviceObj = device(a,'I2CAddress',0x49)
Invalid I2C device address '0x49'. Use scanI2CBus for a list of devices detected on an I2C bus.
I am not able to figure out what I am doing wrong in the deviceObj creation.
I appreciate any suggestion for a solution.

Réponses (1)

Mirko Krah
Mirko Krah le 4 Août 2023
Hey,
the Due has two I2C Busses.
Can you try this:
deviceObj = device(a,'I2CAddress','0x49','Bus',1);
If you are on Bus "0", try ist with this:
deviceObj = device(a,'I2CAddress','0x49','Bus',1);

Catégories

En savoir plus sur MATLAB Support Package for Arduino Hardware dans Help Center et File Exchange

Tags

Produits


Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by