Updates to documentation

This commit is contained in:
Cristian Maglie
2016-01-01 21:14:05 +01:00
parent 59b4222e7d
commit e90aca32c8
14 changed files with 76 additions and 46 deletions

View File

@@ -0,0 +1,29 @@
//
// Copyright 2014-2016 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
package serial_test
import "fmt"
import "log"
import "go.bug.st/serial"
func ExampleSerialPort_SetMode() {
port, err := serial.OpenPort("/dev/ttyACM0", &serial.Mode{})
if err != nil {
log.Fatal(err)
}
mode := &serial.Mode{
BaudRate: 9600,
Parity: serial.PARITY_NONE,
DataBits: 8,
StopBits: serial.STOPBITS_ONE,
}
if err := port.SetMode(mode); err != nil {
log.Fatal(err)
}
fmt.Println("Port set to 9600 N81")
}