Test System Object
MATLAB Command Line
Create an instance of the
DigitalRead
class.dr = DigitalRead()
Execute the
stepImpl
method.dr.step() ans = 0
Remove the
dr
System object™ and test thereleaseImpl
method.clear dr
Simulink Model
To bring the DigitalRead
system object into Simulink®, follow the steps:
Create a new Simulink model.
Add the MATLAB System block from the User-Defined Functions library.
In the block, set System object name to
DigitalRead
.From the Sinks library, add a Scope block to the model.
In the Simulink Editor, select Simulation > Model Configuration Parameters.
In the Configuration Parameters dialog box, on the Hardware Implementation pane, set Hardware board to match your hardware, for example,
'Arduino Due'
.On the Hardware tab of the toolstrip, in the Mode section, select
Run on board
, and then click Monitor & Tune to build and run the model containing your System object on the hardware board.