This example shows how to synchronize models using an Arduino Connected I/O board with real time and using Simulink Desktop Real-Time running in Connected IO mode.
The model sends software-generated pulse-width modulation signal to Arduino pin 13 where it can be observed by an oscilloscope or visually by observing the LED connected to pin 13. The duty of the signal can be controlled by the attached knob control.
Open the model
sldrtex_arduino. In the MATLAB Command Window, type:
To run this model, use this setup:
The model is currently configured for Arduino Mega 2560. If necessary, change the configuration to match your Arduino model.
To change to Connected IO mode (required), on the Desktop Real-Time tab, select Mode > Connected IO.
To start real-time execution, click Run in Real-Time.
Note: This model requires Simulink Support Package for Arduino Hardware.