Using .NET’s SerialPort Classdim portData as String
If (Not (myComPort Is Nothing)) Then
If (Not myComPort.IsOpen) Then
myComPort.Open()
End If
End IfIf myComPort.IsOpen Then
myComPort.ReadLine(portData)
myComPort.WriteLine(portData)
End IfString portData;
if (!(ComPort.selectedPort == null))
{
if (!myComPort.IsOpen)
{
myComPort.Open();
}
}
if (ComPort.selectedPort.IsOpen )
{
portData = myComPort.ReadLine();
myComPort.WriteLine(portData ) ;
}1 3
65
Many applications send and receive data stored in byte arrays and read data into
byte arrays or byte variables.