I've already solved the problem! I achieved my aim using the callbacks which can be accesed by File->Model Properties->Model Properties->Callbacks. I used the the PreLoadFcn and InitFcn to initialize the Arduino board.
Query instrument: initialization with a function
조회 수: 10 (최근 30일)
이전 댓글 표시
Hello, I'm trying to receive data from an Arduino board in Simulink, so I decided to use the block "Query instrument". But I need to initialize the board first, so I built a function (a script but with input and output parameters) where I create a string with some numeric parameters, wait some seconds using the function pause and then the string is sent to the board through the serial port. The pause is necessary because the Arduino board take it a while to be ready to receive serial data. I have configured the "Query instrument" block in such a way that in the initialization it executes the function I wrote. This function works well when I call it from the command window, but I get the following message error when I execute the Simulink model: Undefined function or variable 'initPause(s)'. I have tried to solve it using a function handler but I didn't get a solution. Also, I checked that the current directory was the directory where I saved the function. Why did I receive this error message? The function which is executed in the initialization, does it have to accomplish some rules?
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Arduino Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!