Skip to content

hootrhino/goserial

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Packages

No packages published

Languages

  • Go 99.6%
  • Batchfile 0.4%