MATLAB on the host with MATLAB Support Package for Arduino

In this example, MATLAB is running on a desktop computer to find the ball, calculate the necessary control commands and use the MATLAB Support Package for Arduino to directly control the motors from MATLAB.

To run this example, open and run the function called hostMatlabTargetIO.m.

To stop this example, close the video player. This will run a function which stops the timer object.

An executable or C/C++ code can not be generated from this function because the MATLAB Support Package for Arduino's writePosition function does not support code generation.

As a result, this example does not run efficiently. Also, we can not deploy this code to a computer which does not have MATLAB or Simulink installed.

To see how MATLAB and Simulink can be used to control the host computer and then be converted into an executable, enabling efficient execution and deployability outside of MATLAB and Simulink, see the following two examples.