Load Arduino Files (coding) in Matlab Command Window

3 次查看(过去 30 天)
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