[TD="class: SmallRow"]
[TD="class: MediumRow"][/TD]
Hi,
I wrote a code to read data from device
here is the specs:
$1 coin dropped it will send 1 byte 0x01 to RS232 Serial com Port
$2 coin dropped it will send 2 bytes 0x01
$5 bill dropped it will send 1 byte 0x02
Here My code is: Do you think it is correct?
Thank you:
Private Sub MSComm1_OnComm(ByVal sender As Object, ByVal e As System.EventArgs) Handles MSComm1.OnComm
Dim i As Long
Select Case Me.MSComm1.CommEvent
Case comEvReceive
ReDim inbuffer(Me.MSComm1.InBufferCount) 'Specify the size of the array. InBuffercount gives the number of characters in the InputBuffer
inbuffer = Me.MSComm1.Input
For i = 0 To UBound(inbuffer) 'Ubound(inbuffer) gives the upper bound of the array, which is equal to the number of characters in the InputBuffer
Debug.Print(inbuffer(i))
Select Case (inbuffer(i))
Case 1
monyin = monyin + 1
Case 2
monyin = monyin + 5
End Select
Beep()
Next i
End Select
End Sub
[/TD]