This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Test System Object

MATLAB Command Line

  1. Create an instance of the DigitalRead class.

    dr = DigitalRead()
  2. Execute the stepImpl method.

    dr.step()
    
    ans =
    
         0
  3. Remove the dr system object and test the releaseImpl method.

    clear dr

Simulink Model

To bring the DigitalRead system object into Simulink®, follow the steps:

  1. Create a new Simulink model.

  2. Add the MATLAB System block from the User-Defined Functions library.

  3. In the block, set System object name to DigitalRead.

  4. From the Sinks library, add a Scope block to the model.

  5. In the Simulink Editor, select Simulation > Model Configuration Parameters.

  6. In the Configuration Parameters dialog box, on the Hardware Implementation pane, set Hardware board to match your hardware, for example, 'Arduino Due'.

  7. In the model toolbar, change the Simulation mode to External and the Simulation stop time to Inf.

  8. Click Run to build and run the model containing your System object™ on the hardware board.

See Also

|