Private Declare Function OpenUsbDevice Lib "USBIO.dll" (ByVal a As Integer, ByVal b As Integer) As Boolean
Private Declare Sub OutDataCtrl Lib "USBIO.dll" (ByVal a As Byte, ByVal b As Byte)
Dim a, b(99), c As Integer
Private Sub Command1_Click(Index As Integer)
a = Index
c = 0
End Sub
Private Sub display(no)
For i = 0 To 7
If no Mod 2 = 1 And a = 1 Then G(i).FillColor = RGB(0, 255, 0)
If no Mod 2 = 1 And a = 2 Then R(i).FillColor = RGB(255, 0, 0)
no = no \ 2
Next i
End Sub
Private Sub Timer1_Timer()
b(0) = 1
b(1) = 2
b(2) = 4
b(3) = 8
b(4) = &H10
b(5) = &H20
b(6) = &H40
b(7) = &H80
Label1.Caption = vbCrLf & "Current Time:" & Time$
For i = 0 To 7
G(i).FillStyle = 1
R(i).FillStyle = 1
Next i
If OpenUsbDevice(&H1234, &H6789) Then
For i = 0 To 7
G(i).FillStyle = 0: G(i).FillColor = RGB(0, 128, 0)
R(i).FillStyle = 0: R(i).FillColor = RGB(128, 0, 0)
Next i
OutDataCtrl 0, 0
OutDataCtrl 0, &H10
If a = 1 Then OutDataCtrl b(c), 0: display (b(c))
If a = 2 And c <= 7 Then
OutDataCtrl 2 ^ c, &H20
OutDataCtrl 2 ^ c, &H30
display (2 ^ c)
End If
End If
If a = 3 Then End
If c > 15 Then c = 15 Else c = c + 1
End Sub