Simulink Arduino Due - Problem with Wire.h library
9 views (last 30 days)
Show older comments
Hello, in my current project I have to develop some device drivers for an Arduino Due. The drivers have to be included the wire library, because the devices are connected with the I2C bus of the Arduino Due. Every device driver should be a own simulink block with inputs or outputs. For this part I've already found a detailed step-by-step guide (https://de.mathworks.com/matlabcentral/fileexchange/39354-device-drivers), which helps me great. For my requirements I can't use the finish I2C block, which is already exist. Therefore I have to implement the i2c interface myself. I don't know which libraries are really necessary. With #include Wire.h are no files are found. With #include "../../libraries/Wire/Wire.h" appears some warnings in diagnostic viewer, such as: "warning: undefined reference to `Wire' "
Maybe have someone an idea which libraries are the correct one and where are they placed?
Regards and thanks a lot, Julian
0 Comments
Answers (3)
Ronen Barski
on 27 Jun 2018
Did you solve that problem? I'm also having issues on that matter
0 Comments
Mark Borsuk
on 13 May 2020
I was having the same issue trying to use my Driver for MPU6050 IMU device for the Uno. I found that the following files were required to be at the same folder level as the model you are trying to run:
Wire.h
Wire.cpp
twi.h
twi.c
Previously I had them stored in a different folder with the MPU6050 s-function (although still in the same project and in Path)
This doesn't feel like a very satisfactory solution though, perhaps there is a path setting that I'm missing?
1 Comment
MOHD ISKANDAR PUTRA AZAHAR
on 7 Nov 2020
Hi & good day Mark Borsuk,
AVR and SAM based library are not same. If you want to use Arduino Due (SAM ARM), you should use wire.h & wire.cpp from SAM library. SAM library can be found in this path as follows:
C:\ProgramData\MATLAB\SupportPackages\R2020a\3P.instrset\arduinoide.instrset\portable\staging\packages\sam-1.6.12\sam\libraries\Wire\src
Best of luck.
See Also
Categories
Find more on Modeling 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!