Question

I can perfectly build simulink models and upload it to my Arduino. But I need some more code that I customly create by myself. So how can I add my own custom code with matlab simulink code as well?

In other words, is there a way to get c++ code of the simulink model including Arduino Hardware Support Blocks and make some changes and add some more code and upload it myself?

Was it helpful?

Solution 2

Depending on what code you are trying to add there are different approaches:

  1. Already mentioned by am304, the Custom Code option in the Configuration Paramters
  2. With custom S-Functions you write your own blocks with code that gets included in the model. (You may need to learn TLC)
  3. A more manual approach is customizing the Template Makefile to compile your source files, together with the generated source code from the model.
  4. The main file (rt_main.c) can also be customized.

OTHER TIPS

Yes you can. If my memory serves me well, it's in Configuration Parameters -> Code Generation -> Custom Code. You can include custom code in source files, header files, initialize function and terminate function. You can also include a list of additional include directories, source files and libraries.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top