blync

package module
v0.0.0-...-3fbdc2f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2015 License: Apache-2.0 Imports: 3 Imported by: 0

README

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()
}

Documentation

Index

Constants

View Source
const (
	BlinkOff    = 0x00
	BlinkFast   = 0x46
	BlinkMedium = 0x64
	BlinkSlow   = 0x96
)

Variables

View Source
var Blue = [3]byte{0x00, 0x00, 0xFF}
View Source
var Green = [3]byte{0x00, 0xFF, 0x00}
View Source
var Red = [3]byte{0xFF, 0x00, 0x00}

Functions

This section is empty.

Types

type BlyncLight

type BlyncLight struct {
	// contains filtered or unexported fields
}

func NewBlyncLight

func NewBlyncLight() (blync BlyncLight)

func (BlyncLight) Close

func (b BlyncLight) Close()

func (BlyncLight) Play

func (b BlyncLight) Play(mp3 byte)

16-30 play a tune single time 49-59 plays never ending versions of the tunes

func (BlyncLight) Reset

func (b BlyncLight) Reset()

func (BlyncLight) SetBlinkRate

func (b BlyncLight) SetBlinkRate(rate byte)

func (BlyncLight) SetColor

func (b BlyncLight) SetColor(color [3]byte)

color[0] = r color[1] = g color[2] = b

func (BlyncLight) StopPlay

func (b BlyncLight) StopPlay()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL