C++ to Simulink S function block

5 views (last 30 days)
Prash Kd
Prash Kd on 22 Jul 2020
Commented: Prash Kd on 24 Jul 2020
Hi all,
New matlab user here.
I am currently working on a Arduino project which requires interfacing controller with multiple input and output devices. There already a vast C++ library available in Arduino IDE for all these devices and i'd like to convert them to Simulink S block so i can program / monitor / control them directly from Simulink. There's a way to use standard Arduino simulink peripheral library to interface with these devices and then implement math/logic to convert incoming data to appropriate format however I'd prefer to focus on devloping good control algorithm rather then on creating new peripheral libraries from scratch. So my question is - Is there a comprehensive guide that explains in detail on how to convert existing C++ libraries into s blocks ? Below is link to probably the best video i could find on internet on this subject however coming from non-oops background I'd appreciate if someone can point me to a more structured guide on this.
Note - I have already installed Arduino hadrware support and try to convert adafruit library for MAX6675 into s block. Following the guide above I can "build" the S block however I dont see any data coming in. If i add the inbuilt SPI block then i do see data coming in so i assume there is no issue with the hardware.

Accepted Answer

Arun Kumar
Arun Kumar on 23 Jul 2020
Hi Prash,
To create a device driver for Arduino, you can use the following gude:
And the detailed steps to use 3rd party library with Simulink support package are metioned in the following file exchange submission:
Hope This Helps!!
  1 Comment
Prash Kd
Prash Kd on 24 Jul 2020
Thanks Arun. the link you've shared has complete workflow of C/C++ -> Matlab script wrapper -> Simulink block. Will give this a try

Sign in to comment.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!