sungrow/vendor/github.com/goburrow/serial
2021-01-10 15:20:11 +11:00
..
.gitattributes vendor again 2021-01-10 15:20:11 +11:00
.travis.yml vendor again 2021-01-10 15:20:11 +11:00
generate.bat vendor again 2021-01-10 15:20:11 +11:00
LICENSE vendor again 2021-01-10 15:20:11 +11:00
README.md vendor again 2021-01-10 15:20:11 +11:00
serial.go vendor again 2021-01-10 15:20:11 +11:00
serial_bsd.go vendor again 2021-01-10 15:20:11 +11:00
serial_darwin.go vendor again 2021-01-10 15:20:11 +11:00
serial_linux.go vendor again 2021-01-10 15:20:11 +11:00
serial_posix.go vendor again 2021-01-10 15:20:11 +11:00
serial_windows.go vendor again 2021-01-10 15:20:11 +11:00
termios_bsd.go vendor again 2021-01-10 15:20:11 +11:00
termios_darwin.go vendor again 2021-01-10 15:20:11 +11:00
termios_linux.go vendor again 2021-01-10 15:20:11 +11:00
termios_mipsx.go vendor again 2021-01-10 15:20:11 +11:00
zsyscall_windows.go vendor again 2021-01-10 15:20:11 +11:00
ztypes_windows.go vendor again 2021-01-10 15:20:11 +11:00

serial Build Status GoDoc

Example

package main

import (
	"log"

	"github.com/goburrow/serial"
)

func main() {
	port, err := serial.Open(&serial.Config{Address: "/dev/ttyUSB0"})
	if err != nil {
		log.Fatal(err)
	}
	defer port.Close()

	_, err = port.Write([]byte("serial"))
	if err != nil {
		log.Fatal(err)
	}
}

Testing

Linux and Mac OS

  • socat -d -d pty,raw,echo=0 pty,raw,echo=0
  • on Mac OS, the socat command can be installed using homebrew: brew install socat

Windows