Phidgets

return to Fereshteh's Sandbox


Attach:phidgets.jpg Phidgets are a set of "plug and play" building blocks for low cost USB sensing and control from your PC.

Contents



Download and Installation

Here are the steps to setup the proper environment and get the necessary files:

  • The Phidget installer requires that your system has .NET framework 2.0 or higher.
  • Visit the drivers section at http://www.phidgets.com and get the latest Phidget framework for your operating system.
  • Follow the steps bellow to install the framework:
    • Open up the installer, and proceed through the wizard. Please note that by default, the installer places the Phidget libraries in C:\Program Files\Phidgets.
    • Once the Phidget libraries are installed using the installer, you should see the Phidget icon in the taskbar. Double click on it to bring up the Phidget Control Panel. If the icon does not appear, just find and open the Phidget Control Panel from the start menu.
  • You need the following basic components to get started with programming Phidgets:
    • A Phidget and all the necessary parts (for example if using an InterfaceKit, you also need a sensor to get input)
    • A USB cable
  • Using the USB cable, connect your Phidget to your PC
  • Once the Phidget is connected, it will show up under the General tab of the Phidget Control Panel. This is an indication that your Phidget is connected correctly.
  • Now you are ready to continue to the Recipes and How-To's section.

Recipes and How-To's

Here are the instructions for setting up the programming environment in C#:

  • Generate a new C# Windows Application with a descriptive name such as PhidgetHelloWorld.
  • Launch the Add Reference window (Project -> Add Reference).
  • Under the .NET tab, select the most recent Phidget21.NET library. If it does not appear in this list, then you can Browse to the Phidget Framework installation directory and add the Phidget21.NET.dll. For earlier versions of Visual Studio, you will want to use the Phidget21.NET1.1.dll instead.
  • Now you have access to all the great libraries and classes that are needed to use Phidgets. To add a reference to the libraries type:
 
 using Phidgets;
 using Phidgets.Events;
  • It is recommended to download/run the examples in C# and follow the tutorials.
  • The same with any API, you need to check the API documentation witch is available online and also downloadable.
    • Links are provided under the Links section.

Tutorials and Examples

  • Getting Started with c# Tutorial
  • An older version of the Tutorial
  • C# simple and full examples
    • Some phidgets have several examples of how to use them: a very simple one that shows basic functionality, another one that exercises almost all its properties, and a 3rd that illustrates its skin in action. This is a very valuable resource for learning how to code Phidgets.
    • While these examples were written in Visual Studio 2005 and 2008, Visual Studio 2010 will easily open and upgrade them.
    • Note that due to the way Phidgets are designed, if you try to access a single Phidget through two programs at the same time confusing things may happen.
    • Finally, if you run and stop one program controlling a Phidget, you may have to wait a moment or two (or quit and restart the demo program) before you can use the second program (the 2nd program may not connect to the Phidget).