Set BaudRate, Parity, ReadTimeout, StopBits for COM1 SerialPort : SerialPort : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » SerialPort »

 

Set BaudRate, Parity, ReadTimeout, StopBits for COM1 SerialPort








    



using System;
using System.IO.Ports;

class MainClass {
    static void Main(string[] args) {
        using (SerialPort port = new SerialPort("COM1")) {
            port.BaudRate = 9600;
            port.Parity = Parity.None;
            port.ReadTimeout = 10;
            port.StopBits = StopBits.One;

            port.Open();
            port.Write("Hello world!");

            Console.WriteLine("Wrote to the port.");
        }
    }
}
           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» SerialPort