필터 지우기
필터 지우기

Arduino i2c address not getting identified.

조회 수: 3 (최근 30일)
Sourabh Karmakar
Sourabh Karmakar 2022년 7월 26일
답변: Mirko Krah 2023년 8월 4일
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.

답변 (1개)

Mirko Krah
Mirko Krah 2023년 8월 4일
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);

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for Arduino Hardware에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by