More Info:
- 3919_0 Tags are being used - (T5577)
- Test text has been loaded on each tag using the RFID-Full program
- Phidget control panel sees both readers but, when RFID-Full is launched for each reader, neither device will scan; when one device is connected, each reader will scan.
- Firmware was updated on 10/21/2016 for both devices. Was unable to simultaneously use both devices before and after the firmware update.
- Written Text: test1 Protocol: Phidgets to Tag 1
- Written Text: tes Protocol: Phidgets to Tag 2
Code: Select all
namespace PhidgetsExample
{
class Program
{
public static void Main()
{
//int array that holds serial numbers for both RFID readers. Used to open both devices below
int[] serialNumArray = { 440799, 440591};
try
{
//Declare RFID reader1 object
RFID rfid = new RFID();
//initialize RFID1 reader and attach events
rfid.Attach += new AttachEventHandler(RFIDExample.rfid_Attach);
rfid.Detach += new DetachEventHandler(RFIDExample.rfid_Detach);
rfid.Error += new ErrorEventHandler(RFIDExample.rfid_Error);
rfid.Tag += new TagEventHandler(RFIDExample.rfid_Tag);
rfid.TagLost += new TagEventHandler(RFIDExample.rfid_TagLost);
//open reader 1
rfid.open(serialNumArray[0]);
//Wait for a Phidget RFID to be attached before doing anything with
//the object
Console.WriteLine("waiting for attachment...");
rfid.waitForAttachment();
//Declare RFID reader2 object
RFID rfid1 = new RFID();
//initialize RFID2 reader and attach events
rfid1.Attach += new AttachEventHandler(RFIDExample.rfid_Attach);
rfid1.Detach += new DetachEventHandler(RFIDExample.rfid_Detach);
rfid1.Error += new ErrorEventHandler(RFIDExample.rfid_Error);
rfid1.Tag += new TagEventHandler(RFIDExample.rfid_Tag);
rfid1.TagLost += new TagEventHandler(RFIDExample.rfid_TagLost);
//open reader2
rfid1.open(serialNumArray[1]);
rfid1.waitForAttachment();
//turn on the antenna and the led to show everything is working for both readers
rfid.Antenna = true;
rfid1.Antenna = true;
rfid.outputs[0] = false;
rfid.outputs[1] = false;
rfid1.outputs[0] = false;
rfid1.outputs[1] = false;
//standard example text
Console.WriteLine("Press any key to end...");
Console.Read();
//turn off the led
rfid.LED = false;
rfid.outputs[0] = false;
rfid.outputs[1] = false;
//close both readers and dispose of objects
rfid.close();
rfid = null;
rfid1.close();
rfid1 = null;
Console.WriteLine("ok");
}
catch (PhidgetException ex)
{
Console.WriteLine(ex.Description);
}
}
}
}
/* - RFID simple -
****************************************************************************************
* This program simply displays the data that is generated by an RFID phidget in a very
* simple case and outputs it to the console. This simple example covers the basics of
* connecting and using an RFID phidget. For a more detailed example, see RFID-full.
*
* Please note that this example was designed to work with only one Phidget RFID
* connected.
* For an example showing how to use two Phidgets of the same time concurrently, please see the
* Servo-multi example in the Servo Examples.
*
* Copyright 2007 Phidgets Inc.
* This work is licensed under the Creative Commons Attribution 2.5 Canada License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by/2.5/ca/
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using Phidgets; //Needed for the RFID class and the PhidgetException class
using Phidgets.Events; //Needed for the phidget event handling classes
namespace RFID_simple
{
public class RFIDExample
{
//attach event handler...display the serial number of the attached RFID phidget
public static void rfid_Attach(object sender, AttachEventArgs e)
{
Console.WriteLine("RFIDReader {0} attached!", e.Device.SerialNumber.ToString());
}
//detach event handler...display the serial number of the detached RFID phidget
public static void rfid_Detach(object sender, DetachEventArgs e)
{
Console.WriteLine("RFID reader {0} detached!", e.Device.SerialNumber.ToString());
}
//Error event handler...display the error description string
public static void rfid_Error(object sender, ErrorEventArgs e)
{
Console.WriteLine(e.Description);
}
//Print the tag code of the scanned tag
public static void rfid_Tag(object sender, TagEventArgs e)
{
Console.WriteLine("Tag {0} scanned", e.Tag);
RFID rfid = (RFID)sender; //Used for rfid in event
}
//print the tag code for the tag that was just lost
public static void rfid_TagLost(object sender, TagEventArgs e)
{
Console.WriteLine("Tag {0} lost", e.Tag);
}
}
}