Loading...
PhidgetRFID Read-Write - P/N 1024_0B The Phidgets RFID device reads RFID tags that are brought in close proximity to the reader and returns the tag identification number. Writing data to T5577 tags is also supported.
Note that all Phidget devices are only available in the licensed Widget Designer edition, not the Free version. |
To add a Phidgets RFID device, open the Devices menu and select Phidgets Device > RFID Device. This will open the Configuration dialog. Alternatively, you can add a new device in the Configuration dialog with the "+" button when the dialog is already open.
On the right side, you can name, dis-/enable the device or configure it as explained in the next paragraph.
The Type informs you about the type of device or connection. The Groups lists the groups to which this device belongs. The Name is the unique identifier for this Phidgets RFID object in WD and the general rules for naming objects apply here as well: only letters, numbers and underscores are allowed; the first symbol must be a letter. It is possible to change the default name to a more descriptive one. When scripting, enter this Name to access available members or use the Project object and device Type instead; examples are shown further down.
The Id offers an alternative way to address the device when scripting.
The "Enable" check box is ticked per default. On the left side, you should see that the icon in front of your Phidgets RFID is a filled blue circle. An empty blue circle indicates an enabled device which is not connected. A filled gray circle indicates a disabled device.
You can close the dialog at any time. The newly created device will also be added to the Devices menu > Phidgets Device > RFID Device and can be opened from here or with Devices menu > Configuration.
Select the Serial number of the connected device from the drop-down. There are four On / Off buttons to manually set the on / off state of the Antenna, Internal LED, External LED and External digital Output of the RFID reader. |
After adding a Phidgets RFID, it can also be scripted which allows to perform actions on the device as well as retrieve information from it.
To send commands to the device, create a CustomScript button or anything with a scripting field. Enter the device's identifier name into the script field (per default that is e.g. "Phidgets_PhidgetRFID1") and Script Assist will offer a list of all available members.
The RFID Phidget can for example also write strings to tags (if they are rewritable):
Phidgets_PhidgetRFID1.WriteTag("test","PhidgetTAG")
When you write a new string on a tag, keep in mind to follow the tag string requirements of the protocol you are using.
You can also retrieve specific values via scripting in the same way as from other widgets. If a tag is currently present, the following command writes its string to a WD variable. To detect a tag automatically and trigger a custom command, please use the Event Listener as described below.
vstring = Phidgets_PhidgetRFID1.TagString
The scripting structure for Phidgets provides two different approaches for setting and retrieving values.
If you are already familiar with the object-based notation and using properties, all device properties can be used like any other object property you have already encountered:
Phidgets_PhidgetRFID1.ExternalLedEnabled = True
Label5.Text = "Current LED State: " + Phidgets_PhidgetRFID1.ExternalLedEnabled
If you prefer a command structure that distinctly implies the action to be performed, you can use the "Set..." and "Get..." members:
Phidgets_PhidgetRFID1.SetExternalLedEnabled(True)
Label5.Text = "Current LED State: " + Phidgets_PhidgetRFID1.GetExternalLedEnabled
Both approaches can be used interchangeably.
Please keep in mind that some properties are read-only properties, e.g. "TagString", and do not provide a "Set..." member.
Furthermore, the higher-level properties of the device itself, like the Serial number or the Enabled state, need to be scripted as properties and do not provide the "Set..." and "Get..." members.
For a list with all available members and commands with examples and descriptions, please refer to the chapter Phidgets RFID Members.
As an alternative to explicitly naming the device, the "Project" object can be used. Choose the device type and address the device by entering its ID or name. Script Assist then offers you the same list of members. This is the alternative for the first example from above:
Project.Phidgets_PhidgetRFID(1).WriteTag("test","PhidgetTAG")
Substituting the ID with a dynamic variable allows automation. Actions can be performed on many connections of the same type simultaneously, e.g. by using for-loops:
For i = 1 to 10 {
Project.Phidgets_PhidgetRFID(i).WriteTag("test","PhidgetTAG")
}
The chapter "Project and Context Member" shows more examples with for-loops and if-clauses; of course, normal variables can also be used.
Event Listeners can be added in the Configuration dialog and provide a simple way of listening to triggers from connected devices.
Please see the chapter Event Listener and Group Event Listener for a detailed description of its functionality and the Phidgets RFID Events chapter for a list (with examples and description) of the possible events raised by this device type.
The most interesting event is probably the "TagEnter" event which is raised when a new tag has been detected. It allows you to use the "tag" parameter in scripting. The following command writes the the tag's string to a WD variable. You could add an if-else-statement or switch statement to execute actions based on a specific tag.
vstring = tag