SerialPort Class Represents a serial port resource. : SerialPort « Development « VB.Net






SerialPort Class Represents a serial port resource.

 

Imports System
Imports System.IO.Ports
Imports System.Threading

Public Class PortChat
    Shared _serialPort As SerialPort

    Public Shared Sub Main()

        Dim message As String
        Dim sComparer As StringComparer = StringComparer.OrdinalIgnoreCase
        _serialPort = New SerialPort()
        _serialPort.ReadTimeout = 500
        _serialPort.WriteTimeout = 500

        _serialPort.Open()

        _serialPort.WriteLine("message")
        message = _serialPort.ReadLine()
        Console.WriteLine(message)
    End Sub
End Class

   
  








Related examples in the same category

1.Available Ports
2.Available Parity options
3.Available Stop Bits options
4.Available Handshake options
5.SerialPort.DataReceived Event
6.SerialPort.GetPortNames Method Gets an array of serial port names for the current computer.