Skip to content

Commit

Permalink
update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gc87 committed Jun 12, 2015
1 parent 5a68ada commit 134023c
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Windup
------
======

Serial port access library on c#.

Expand All @@ -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

0 comments on commit 134023c

Please sign in to comment.