This example demonstrates a more functional RFID phidget.

This program just displays the current tag number and adds a new line every time the tag has been seen.

    'A Simple RFID Demonstration
    'Keep adding tag ID's as fast as we can see them to the top of the listbox
    'Notice that there can be many multiple reads on a single tag
    Option Explicit
    Private WithEvents PM As PhidgetManager
    Dim WithEvents RF As PhidgetRFID
    Dim L As ListItem

    Private Sub Form_Load()
        Set PM = New PhidgetManager

        'Set up the list box
        lvTag.View = lvwReport
        lvTag.GridLines = True
        lvTag.ColumnHeaders.Add 1, , "Count", 1000
        lvTag.ColumnHeaders.Add 2, , "Tag #", 5000
    End Sub

    'When the reader appears, set things up and say so
    Private Sub PM_OnAttach(ByVal PHIDGET As IPhidget)
        Dim I As Integer
        If PHIDGET.DeviceType = "PhidgetRFID" Then
            Set RF = PHIDGET
            lblLibraryVersion.Caption = RF.LibraryVersion
            lblReaderStatus.Caption = "PhidgetRFID" & " Version " & RF.DeviceVersion & ", Serial# " & RF.SerialNumber
            lblHelp.Caption = "Place RFID Tags over the reader"

            For I = 0 To RF.NumOutputs - 1
                DigitalOutput(I).Enabled = True
            Next I

            RF.OutputState(3) = True        'Output #3 Enables RFID reader
            DigitalOutput(3).Value = 1      'Display check mark on screen

            RF.OutputState(2) = True        'Output #3 Enables onboard LED
            DigitalOutput(2).Value = 1      'Display check mark on screen
        End If
    End Sub

    'When the reader disappears, say so
    Private Sub PM_OnDetach(ByVal PHIDGET As PHIDGET.IPhidget)
        Dim I As Integer
        If PHIDGET.DeviceType = "PhidgetRFID" Then
            lblReaderStatus.Caption = "Attach an RFID tag reader"
            lblHelp.Caption = ""
            For I = 0 To RF.NumOutputs - 1
                DigitalOutput(I).Enabled = True
            Next I
            Set RF = Nothing
        End If
    End Sub

    Private Sub RF_OnTag(ByVal TagNumber As String)
        Static count As Integer
        count = count + 1
        Set L = lvTag.ListItems.Add(1)
        L.SubItems(1) = TagNumber
        lvTag.ListItems.Item(1) = count
    End Sub

    Private Sub DigitalOutput_Click(Index As Integer)
        If DigitalOutput(Index).Value = 0 Then
            RF.OutputState(Index) = False
        Else
            RF.OutputState(Index) = True
        End If
    End Sub