필터 지우기
필터 지우기

Load Arduino Files (coding) in Matlab Command Window

조회 수: 6 (최근 30일)
Noor Amira Ilyanie
Noor Amira Ilyanie 2023년 4월 18일
편집: Walter Roberson 2023년 4월 18일
I have my coding in forms of arduino (.ino). I need to call or load the files in matlab command window. How can i load the arduino files?

답변 (1개)

Walter Roberson
Walter Roberson 2023년 4월 18일
편집: Walter Roberson 2023년 4월 18일
You cannot.
.ino files are plain-text files, but they are not written in a programming language that MATLAB can execute.
Arduino ino files are put through a pre-processor to create C++ code files, which are then compiled on the host, creating a binary executable to be written to the arduino and executed there.
The arduino does not have a file system; it does not have any ability to store different ino files (or the executables) and invoke the appropriate one at need -- only the ability to send a current executable to the device for execution.
The closest you can get would be to write a "switchyard", code something along the lines of
read a byte
switch() on the byte to call one of several different functions
the function would, if needed, read more parameters from the input line
and then compile the files all into one executable. The MATLAB program would then serialport() the arduino, and then make calls like
inof = dictionary({'start_vacuum', 'advance_motor', 'stop_vacuum'}, {int8(1), int8(2), int8(3)});
parameters = [typecast(3.5, 'int8'), int8(-2)];
write(ARDUINO, [inof('start_vacuum'), parameters])

카테고리

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

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by