/goblync

A Go library for interacting with BlyncLight devices

Primary LanguageGoApache License 2.0Apache-2.0

GoBlync

goblync is a Go library for interacting with BlyncLight devices. This library is compatible with BlyncLight v3.

Building

Based on the dependency on Go HID, the following operating systems are supported targets (as used by $GOOS environment variable)

  • darwin (uses native IOKit framework)
  • linux (uses libusb 1.0+)
  • windows (uses native Windows HID library)
go get github.com/boombuler/hid
go build

For building on Windows, see the potential quirks listed here.

Usage

package main

import (
	"github.com/davidehringer/goblync"
	"time"
)

func main() {

	light := blync.NewBlyncLight()
	time.Sleep(time.Second * 2)
	light.SetColor(blync.Red)
	light.Play(52)
	time.Sleep(time.Second * 5)
	light.SetColor(blync.Blue)
	time.Sleep(time.Second * 5)
	light.StopPlay()
	light.Reset()

	for i := 0; i < 256; i++ {
		light.SetColor([3]byte{byte(i), 255 - byte(i), 0x00})
		time.Sleep(13 * time.Millisecond)
	}
	light.SetBlinkRate(blync.BlinkMedium)
	time.Sleep(time.Second * 5)
	light.Close()
}