Read binary data from the serial port.
INPUTBIN var1 [,var2]
INPUTBIN #channel , var1 [,var2]
The variable that is assigned with the characters from the serial port.
An optional second (or more) variable that is assigned with the data from the serial input stream.
The number of bytes to read depends on the variable you use.
When you use a byte variable, 1 character is read from the serial port.
An integer will wait for 2 characters and an array will wait until the whole array is filled.
Note that the INPUTBIN statement doesn't wait for a CRLF but just for the number of bytes.
You may also specify an additional numeric parameter that specifies how many bytes will be read. This is convenient when you are filling an array.
Inputbin ar(1) , 4 ' will fill 4 bytes starting at index 1.
Dim A As Byte , C As Integer
Inputbin A , C 'wait for 3 characters