MATLAB Answers

Change and save parameter / variable for next startup on an arduino target using simulink

14 views (last 30 days)
Denis Becker
Denis Becker on 20 Apr 2020
Answered: Arun Kumar on 29 Apr 2020
Hi guys!
I have an Arduino Mega and want to deploy my Simulink Model on this target so the Model can run on its own without a PC, Matlab etc. In my Model i want to able to change the some settings and save theses changes permanently. The thing is i dont want to save this settings just for the actual runtime but for the next start after the Arduino is shutdown / restarted. What i want to achieve is just to save some values for my model for the next startup, like in a settings menu.
If i am correct i need to change the variables / parameters in the Model workspace. A already tried using the Data Store blocks but, as expected i am loosing the values for the next Start of the Arduino. I also tried to use "Simulink.Paramter" to change the Variables in the Workspace but i did something wrong resulting in:
The 'Simulink.Parameter' class does not support code generation
So my question is: Is it possible to change and save values in my model for the next start of the arduino? And if so how?
Thanks in advance!

Answers (1)

Arun Kumar
Arun Kumar on 29 Apr 2020
Hi Denis,
What I understood from your question is that you want to store some data during runtime and read that data during the next/subsequent runs. On mega, this can be achieved by using the onboard EEPROM:
There's no block for EEPROM read/write in the support package, but you can create your own block by following this simple guide:
Hope this helps!

Community Treasure Hunt

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

Start Hunting!