Skip to content
/ gocanusb Public

Golang implementation for using the LAWICEL CANUSB DLL in Windows

License

Notifications You must be signed in to change notification settings

roffe/gocanusb

Repository files navigation

goCANUSB

Golang implementation for using the [https://www.canusb.com/products/canusb/](LAWICEL CANUSB) Windows DLL

examples

Used in goCAN

Usage

Download the appropriate DLL and place next to your built Go binary or Windows system folder

go get github.com/roffe/gocanusb@latest
package main

import (
	"log"

	"github.com/roffe/gocanusb"
)

func main() {
	// open the first available device
	ch, err := gocanusb.Open(
		"",
		"500",
		gocanusb.ACCEPTANCE_CODE_ALL,
		gocanusb.ACCEPTANCE_MASK_ALL,
		gocanusb.FLAG_TIMESTAMP|gocanusb.FLAG_BLOCK|gocanusb.FLAG_NO_LOCAL_SEND|gocanusb.FLAG_SLOW,
	)
	if err != nil {
		log.Fatal(err)
	}
	defer ch.Close()

	ver, err := ch.VersionInfo()
	if err != nil {
		log.Fatal(err)
	}
	log.Println("CANUSB version: ", ver)
}

Disclaimer

LAWICEL CANUSB and LAWICEL CAN232 are trademarks of ELMICRO Computer GmbH & Co. KG

About

Golang implementation for using the LAWICEL CANUSB DLL in Windows

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages