Main Content

Run Model onArduinoHardware

You can prepare, configure, and run a model on your Arduino®hardware.

Before starting this procedure:

  • Connect your Arduino hardware to the host computer using a USB cable.

  • Create or open a Simulink®model.

To prepare and run the model:

  1. UseFile>Save Asto create a working copy of your model. Keep the original model as a backup copy.

  2. In the Simulink model, on theModelingtab, clickModel Settingsto open the Configuration Parameters dialog box.

  3. When theHardware Implementationpane opens, set theHardware boardparameter to the specific Arduino board you are using.

  4. On theHardwaretab of the Simulink model, in theModesection, selectRun on boardand then clickBuild, Deploy & Start.Build, Deploy & Start on Arduino Hardware Boards

    This action automatically downloads and runs your Simulink model on the board.

Note

If you want to use ENUM data in external mode with Arduino boards, use a built-in integer data type such as int8, uint8, int16, uint16, and int32 to derive the ENUM data. For more information, refer toDefine Simulink Enumerations.