Skip to content

Latest commit

 

History

History
34 lines (30 loc) · 543 Bytes

README.md

File metadata and controls

34 lines (30 loc) · 543 Bytes

go serial port

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("ok"))
	if err != nil {
		log.Fatal(err)
	}
}

Testing

Linux

socat

sudo apt install socat
socat -d -d pty,raw,echo=0 pty,raw,echo=0

Windows