This example demonstrates a minimal RFID phidget.

Very simple program just displays the current tag number and the number of times that tag has been seen.

    'Name:    rfid_Simplest
    'Author:  Saul Greenberg, April 2002
    'Purpose: Display a tag's id and how many times it is sensed
    Dim WithEvents PM As PhidgetManager
    Dim WithEvents rfid As PhidgetRFID

    Private Sub Form_Load()
        Set PM = New PhidgetManager
        lblTag.Caption = "Attach an RFID Tag Reader"
    End Sub

    Private Sub PM_OnAttach(ByVal PHIDGET As PHIDGET.IPhidget)

        If PHIDGET.DeviceType = "PhidgetRFID" Then
            Set rfid = PHIDGET
            rfid.OutputState(3) = True        'Output #3 Enables RFID reader
            lblTag.Caption = "Tag number: "
        End If
    End Sub

    Private Sub PM_OnDetach(ByVal PHIDGET As PHIDGET.IPhidget)
        If PHIDGET.DeviceType = "PhidgetRFID" Then
            lblTimes.Caption = ""
            lblTag.Caption = "Attach an RFID Tag Reader"
        End If
    End Sub

    Private Sub rfid_OnTag(ByVal TagNumber As String)
        Static PreviousTag As String
        Static Count As Long
        If TagNumber = PreviousTag Then Count = Count + 1 Else Count = 1
        lblTag.Caption = "Tag number: " & TagNumber
        lblTimes.Caption = "Times seen: " & Count
        PreviousTag = TagNumber
    End Sub