From iLab Cookbook

Toolkits: HowToFilterPhidgetsBySerialNumberOrLocation

<< Back to the SharedPhidgets page


When you create a new Phidget device, it normally will connect to the next device of the same type (e.g., phidgetservo) it founds in the PhidgetManager. To connect to a specific device, you can add serial and location filters to the device.
There are two ways to add serial and location filters to your Phidget components: with specifying the property in the Visual Studio GUI builder, or by adding the information in the programm code.

1. Using the Visual Studio GUI builder:

1) Create your Phidget component by selecting a new object in the toolbox and clicking on your form (here: a servo object as an example, it works in the similar way for all Phidgets):

2) Select the created component and search the property FilterSerialNumber in the properties window of Visual Studio (usually on the right side of the screen)
3) Select the "..." Button of the property entry:

4) Click the Add button and select the Int32 value in the right list of the dialog window.
5) Enter your serial number here (only numeric characters) and click OK.

6) Finished! You can add more serial numbers if you like. The specification of locations works in the smae way, you only have to select the FilterLocations property and then insert the location name.


2. Specifying in the source code


// Create a new Phidget component, here as an example the Phidget servo
GroupLab.SharedPhidgets.Servo servo = new GroupLab.SharedPhidgets.Servo();

// Add a serial number information
servo.FilterSerialNumbers.Add(123);

// You can add as many serial numbers as you like, if you want
// that the component can be connected to different physical devices
servo.FilterSerialNumbers.Add(7228);

// Specify the location
servo.FilterLocations.Add("My Location");
 



Retrieved from http://grouplab.cpsc.ucalgary.ca/cookbook/index.php/Toolkits/HowToFilterPhidgetsBySerialNumberOrLocation
Page last modified on January 25, 2006, at 12:18 PM