Arduino i2c address not getting identified.
8 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Mirko Krah
on 4 Aug 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);
0 Comments
See Also
Categories
Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!