Generate C Code from Simulink and place it into Arduino?

조회 수: 16 (최근 30일)
Daniel
Daniel 2016년 10월 7일
댓글: Daniel 2016년 10월 7일
Hello.
I have made a super easy PID controler in Simulink. The PID controler is into a subsystem. The subsystem has two inputs (SET, Analog) and one output (Interval).
I can generate that subsystem by right click C/C++ -> Build System.
Then i also get a report about the code. The problem is that i expect just one or two c-files (header and C-file). But i got many C-files so it confusing me.
What should i do with all these files? This is a tiny subsystem and i don't want more that 4 files.
What should i do? Did i have done the right thing or are setup wrong?

채택된 답변

Swarooph
Swarooph 2016년 10월 7일
You should do 2 things.
  1. Download the free support package that helps you generate appropriate code from your Simulink model, builds it and the downloads it on to the Arduino with a click of a button.
  2. Once you see this support package in the Simulink library browser, identify the input and output driver blocks to your application (Digital Input or Analog Input etc., Digital Output or PWM or Servo Write etc.) and use them appropriately for your PID inputs and outputs.
Take a look at this video for relevant information.
  댓글 수: 1
Daniel
Daniel 2016년 10월 7일
Hello!
I have install that package and it works for me. But now I'm not using Simulink Coder, only Simulink with an add-on package for Arduino.
It probably does not work to generate C code from Simulink Coder who fits Arduino? Arduino using C++ and not C by the way. A lot of people saying that Arduino are using C, that's wrong.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by