From 134023c92113d23f4f0bab3b668ed887aeb245a8 Mon Sep 17 00:00:00 2001 From: gaoc Date: Fri, 12 Jun 2015 14:46:58 +0800 Subject: [PATCH] update readme.md --- README.md | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 03906a1..7e019c0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ Windup ------- +====== Serial port access library on c#. @@ -9,53 +9,53 @@ Serial port access library on c#. >Get all serial port name. ```C# - string[] portNames = GetSerialPorts (); +string[] portNames = GetSerialPorts (); ```` >Test a serial port is busy. ```C# - var isBusy = Talker.TouchSerialPort ("COM3", 9600) +var isBusy = Talker.TouchSerialPort ("COM3", 9600) ```` >Create a instance of Talker. ```C# - var talker = new Talker () { - PortName = "COM3", - BaudRate = 9600, - LineBreak = new LineBreak () { //set linebreak type - Type = "nt", - }, - Proc = list => { // data arrived process method(important) - var str = string.Empty; - foreach (var i in list) { - var ch = (char)i; - str += ch; - } - Console.WriteLine ("echo str: {0}", str); +var talker = new Talker () { + PortName = "COM3", + BaudRate = 9600, + LineBreak = new LineBreak () { //set linebreak type + Type = "nt", + }, + Proc = list => { // data arrived process method(important) + var str = string.Empty; + foreach (var i in list) { + var ch = (char)i; + str += ch; } - }; + Console.WriteLine ("echo str: {0}", str); + } +}; ```` >Open talker if it's not opened. ```C# - if (!talker.IsOpen) { - talker.Open (); - } +if (!talker.IsOpen) { + talker.Open (); +} ```` >Write byte data to serialport. ```C# - talker.Write (new byte[] { 10, 12, 11, 17, 18 }); +talker.Write (new byte[] { 10, 12, 11, 17, 18 }); ```` >Close talker. ```C# - var isSuccessed = talker.Close(); +var isSuccessed = talker.Close(); ```` ###License \ No newline at end of file