How to add an arduino library to Simulink for C-Caller ?
3 views (last 30 days)
Show older comments
I am currently trying to connect a BNO080 board to an Arduino Uno via Simulink. I have attempted to do it via i2c in simulink with arduino master read, but unfortunately it does not work. What I am trying to do now is download the sparkfun BNO080 library: Link and utilize it via the c caller block in simulink. I have added the header files, but canoot get it to work because in the header file it requires the "Wiring.h" file. When Ii download that, I need another additional .h file to make "Wiring.h" work etc... Eventually it ends up as an infinite loop, because the majority of these .h files need other .h files.
I have been banging my head against the wall for some bit and I am completely lost. Could someone please help?
Here is how I added the .h file and .cpp file. For the .c file, I have utilized the "Accelerometer.c" file provided in the library mentioned above.
The c-caller function parameters:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/375631/image.jpeg)
An example of one of the many errors I get:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/375641/image.jpeg)
My folder looks like this and the .h amount of files just keeps on increasing...
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/375636/image.jpeg)
0 Comments
Answers (1)
Arun Kumar
on 13 Oct 2020
Hi Joncikas,
The recommended way of interfacing sensors to Arduino is by creating a custom block by following the device driver guide.
Please use the following guide to create your own device driver:
Hope this helps!
Thanks,
Arun
0 Comments
See Also
Categories
Find more on Device Driver Blocks 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!