C
cmdolcet69
The sub below reads the value of position from my serial write
command. However i need to read only the (3) and (4) index of the byte
array and then need to convert it into a integer. When i get to the
step invalue = bitconverter.toint32(Newpacket,0) line i trigger an
error saying that the byte array is less than the read byte array.
How can i only grab position (3) and (4) and then return there values
in integer.
Public invalue as integer
Public Sub ProbeBitValues()
Dim Packet(7) As Byte
Dim NewPacket(2) As Byte
SerialPort2.Read(Packet, 0, 7)
NewPacket(0) = Packet(3)
NewPacket(1) = Packet(4)
indvalue = BitConverter.ToInt32(NewPacket, 0)
End Sub
command. However i need to read only the (3) and (4) index of the byte
array and then need to convert it into a integer. When i get to the
step invalue = bitconverter.toint32(Newpacket,0) line i trigger an
error saying that the byte array is less than the read byte array.
How can i only grab position (3) and (4) and then return there values
in integer.
Public invalue as integer
Public Sub ProbeBitValues()
Dim Packet(7) As Byte
Dim NewPacket(2) As Byte
SerialPort2.Read(Packet, 0, 7)
NewPacket(0) = Packet(3)
NewPacket(1) = Packet(4)
indvalue = BitConverter.ToInt32(NewPacket, 0)
End Sub