Categorygithub.com/grid-x/serial
modulepackage
0.0.0-20211107191517-583c7356b3aa
Repository: https://github.com/grid-x/serial.git
Documentation: pkg.go.dev

# README

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

# Packages

No description provided by the author

# Functions

Open opens a serial port.

# Variables

ErrTimeout is occurred when timing out.

# Structs

Config is common configuration for serial port.
platform independent RS485 config.

# Type aliases

Port is the interface for controlling serial port.