GroupLab.Phidgets.NET Library
|

|
About
The GroupLab.Phidgets.NET library provides
a set of Microsoft.NET Common Language Runtime wrappers for the Phidgets™ library. These wrappers make it
easier to program phidgets in C# and other .NET languages than using the COM
Interop assemblies that automatically generated by Visual Studio .NET.
Download
Getting Started
Before you begin…
- Use the Add/Remove Programs control panel
to uninstall anything Phidget related. The package you will install has
all the necessary bits and it is important to start with a clean
configuration to avoid conflicts. To verify things are uninstalled, verify
that there does NOT exist a file called phidget20.dll in C:\WINDOWS\system32
- Remove Phidgets from the Visual Studio
.NET Toolbox
- Start Visual Studio .NET
- Delete any tabs created to hold
Phidget.NET wrappers
- Delete any items from remaining tabs for
Phidget.NET wrappers
After you’ve downloaded/installed the package, above…
- Start Visual Studio .NET
- Right-click the Toolbox and choose ‘Add
Tab’ from the context menu. Name the tab “Phidgets”
- Click on the Phidgets tab to open it and
then right-click inside it and choose ‘Add/Remove items’
- Sort the list by Namespace and then place
a check mark against all components in the GroupLab.Phidgets and
GroupLab.Phidgets.UI namespaces. Click OK to close the dialog box and add
the items to the tab. It should appear as follows:

Test it…
- Create an empty C# Windows Forms
application
- From the Toolbox, drag and drop a Servo
phidget onto the form. It will appear as an icon in the Windows Forms
Designer component tray (a yellow region beneath the form in the
designer).
- From the Toolbox, drag and drop a
ServoSkin control onto your form.
- Position and size the control on your
form however you wish.
- Change the ServoSkin.Servo property from
its current value (none) to servo1
- Run the program
- Attach a Servo motor phidget to the
computer. The ServoSkin control on your form should update to reflect that
the servo has been attached and you should be able to move the motor by
dragging the slider.
- If you want, you can experiment with
controlling the motor position programmatically:
- Drag a Button control onto your form
- Add a Click event handler for the button
- In the source code for the button event
handler, add:
if(servo1.Motors[0].Position
< 90)
{
servo1.Motors[0].Position = 180;
}
else
{
servo1.Motors[0].Position = 0;
}
- Re-run your program and click the button
to toggle the motor position between 0° and 180° with each
button click.
Known bugs / Future work
- Missing / incorrect Intellisense
summaries
- Missing wrappers:
- Thermocouple
- Accelerometer
- Missing skins (available in the current
release: InterfaceKit, PhidgetManager, RFID, Servo, TextLCD, WeightSensor)
- There is a plan underway to complete
remove the COM dependency and work with the phidget20.dll library directly
from C#
Contact
Saul Greenberg (saul@cpsc.ucalgary.ca)