Files:

-PhidgetInterfaceKit_simple.mdl
An example Simulink model showing the use of the Phidget InterfaceKit 8/8/8. 
Simulating the model will produce the following:
1. 8 sensor values will be retrieved and displayed in a scope
2. 8 digital outputs will be set randomly to true or false
3. The model will run for approximately 10 seconds.
You may need to change the number of inputs/outputs depending on the type of PhidgetInterfaceKit you have.
This example requires that all the following files be in the same working directory.

To run PhidgetInterfaceKit_simple.mdl, the following steps will need to be followed:
1. You will need the phidget21Matlab.h from the MATLAB examples. Please place the phidget21Matlab.h
in the MATLAB path or in the same directory as PhidgetInterfaceKit_simple.mdl. 
2. The Simulink examples folder will need to be added to the MATLAB path. Go to File->Set Path->Add with Subfolders and select the Simulink examples folder. Save.



-phidget21Matlab.h
Header file to use with the Phidget library



-getSensorValues.m
.m file used by a Level 1 S function that demonstrates how to retrieve sensor values.



-setOutputStates.m
.m file used by a MATLAB function that demonstrates how to set the output states.



-PhidgetInterfaceKit.m
A block that demonstrates how to create a single instance of a PhidgetInterfaceKit. There can only be one instance of this block in the model. This block loads the Phidget library and runs the following commands
CPhidgetInterfaceKit_create
CPhidget_open
CPhidget_waitForAttachment
This block is used in the PhidgetInterfaceKit_simple.mdl example.



-PhidgetInterfaceKit_RemoteIP.m
A block that demonstrates how to create a single instance of a PhidgetInterfaceKit. There can only be one instance of this block in the model. This block loads the Phidget library and runs the following commands
CPhidgetInterfaceKit_create
CPhidget_openRemoteIP - 
CPhidget_waitForAttachment
To use this block in PhidgetInterfaceKit_simple.mdl, please follow the following steps.

1. Ensure that the Phidget Webservice is started. For mroe information, please see the "Working with Phidget Webservice" guide on www.phidgets.com >> Programming
2. Open up PhidgetInterfaceKit_simple.mdl
3. Remove the PhidgetInterfaceKit block in the model 
4. Open up the Simulink Library Browser
5. Select the Phidget library in the Simulink  Library Browser
6. Add the PhidgetInterfaceKit_RemoteIP block to the model
7. Double click on the PhidgetInterfaceKit_RemoteIP to bring up the block parameters 
8. Enter in the serial number. You can also specify -1 to open up any PhidgetInterfaceKit
9. The IP address of the Webservice. It is enclosed in single quotes
10. The Port number that the Webservice is running on 
11. The Password of the Webservice. It is enclosed in single quotes
12. Click on Apply and OK
13. Start the simulation.



-Phidgets.mdl
A sample library containing the PhidgetInterfaceKit.m and PhidgetInterfaceKit_RemoteIP.m blocks



-rtc.mdl, -waitfortreal.m
Files neccessary for approximate real time clock functionality. 
For more information, please see: http://www.mathworks.com/support/solutions/en/data/1-15JAW/



-slblocks.m
Used by Simulink to load the Real Time Block and Phidget blocks to the Simulink Library Browser. 
