Azzera filtri
Azzera filtri

Arduino i2c address not getting identified.

2 visualizzazioni (ultimi 30 giorni)
Sourabh Karmakar
Sourabh Karmakar il 26 Lug 2022
Risposto: Mirko Krah il 4 Ago 2023
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.

Risposte (1)

Mirko Krah
Mirko Krah il 4 Ago 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);

Categorie

Scopri di più su MATLAB Support Package for Arduino Hardware in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by