Load Arduino Files (coding) in Matlab Command Window

7 ビュー (過去 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 Center および File ExchangeArduino Hardware についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by