This package contains a guide that explains, in a step-by-step fashion, how to develop device driver blocks (blocks that perform target-specific functions when executed on a target platform).
Example drivers for:
-) Arduino digital output
-) Arduino digital input
-) Arduino analog output
-) Arduino encoder read
-) DC Motor (AF Motor Shield V1 & V2)
-) Stepper Motor (AFMotor Shield V1 & V2)
While the examples are built using the Arduino as the hardware platform (specifically relying on the Simulink Support Package for Arduino), the method is the same for any other supported target.
The general method (and the main examples) described in the guide are based on the S-Function builder, however, since December 2013, some examples relying on the Embedded MATLAB block are also given (in the zip file EML2.zip).
In general, this latter approach works better for developing more complex drivers and driver blocks that have to be redistributed and masked. On the other hand the S-Function builder approach might be better for developers that are more familiar with C than Embedded MATLAB and need to quickly develop simple drivers that don't have a lot of parameters.
Finally, note that for MATLAB 2013b you will need to apply a fix for the S-Function builder to develop blocks with no input. To do so, go to the following page: http://www.mathworks.com/support/bugreports/1006532 , scroll down to the bottom, and follow the instructions therein.