Create your own Simulink model

1. In MATLAB, select New > Simulink Model under the HOME Tab

2. Click on the Library Browser Icon on the simulink model and go to Sources tab under Simulink in the Simulink Library Browser window

3. Drag the Pulse Generator block from the Sources library to your model and change the values as shown here

4. Use the LED Block from Simulink Support Package for Raspberry Pi Hardware in the Library Browser and change the parameters as shown here

5. Drag and drop the Data Type Conversion block from the Signal Attributes tab under the Simulink library

6. When you move the mouse pointer close to the arrow on the block, it will change to a plus sign. Left click when you seee the plus sign and drag the mouse to make the intended connection. Once the connection is made you can release the left click button.  

7. Save this model and to configure the model go to Tools > Run on Target Hardware > Prepare To Run... 

8. When the Configuration Parameters page opens up, set the Target hardware parameter to Raspberry Pi. Do not change any other settings.

9. In your Simulink model, click the Deploy To Hardware button on the toolbar. Code will be generate from the model, which is then deployed to your Pi 2. The on-board LED should blink one time every second.

This guide was first published on Apr 16, 2015. It was last updated on Mar 08, 2024.

This page (Using Simulink Support Package and Raspberry Pi) was last updated on Mar 08, 2024.

Text editor powered by tinymce.