package module
v0.0.0-...-d94ba02 Latest Latest

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

Go to latest
Published: Feb 25, 2019 License: MIT Imports: 5 Imported by: 4


Package to control USB-LED devices

Supported OS

  • OSX
  • Windows
  • Linux

Supported devices


Most of the device control knowledge is taken from the NotifierLight project.


See GoDoc

Code example

package main

import (

var RED color.RGBA = color.RGBA{0xFF, 0x00, 0x00, 0xFF}

func main() {
    for devInfo := range led.Devices() {
        dev, err := devInfo.Open()
        if err != nil {
        defer dev.Close()

        time.Sleep(2 * time.Second) // Wait 2 seconds because the device will turn off once it is closed!




This section is empty.


View Source
var ErrDeviceClosed = errors.New("Device is already closed")

Error: Device was already closed and is not ready for interaction anymore

View Source
var ErrKeepActiveNotSupported = errors.New("KeepActive is not supported by this device")

Some devices does not support KeepActive.


func Devices

func Devices() <-chan DeviceInfo

Devices returns a channel with all connected LED devices


type Device

type Device interface {
	// SetColor sets the color of the LED to the closest supported color.
	SetColor(c color.Color) error

	// SetKeepActive sets a value that tells the device not turn off the device on calling Close. By default the device is turned off!
	SetKeepActive(v bool) error

	// Close the device and release all resources

Device is an opened LED device.

type DeviceInfo

type DeviceInfo interface {
	// GetPath returns a system specific path which can be used to find the device
	GetPath() string
	// GetType returns the "driver type" of the device
	GetType() DeviceType
	// Open opens the device for usage
	Open() (Device, error)

DeviceInfo keeps information about a physical LED device

func ByPath

func ByPath(path string) (DeviceInfo, error)

ByPath searches a device by given system specific path. (The path can be obtained from the GetPath func from DeviceInfo)

type DeviceType

type DeviceType int

Device type identifies the device type. the IDs may change on each program start.

var Blink1 DeviceType

Device type: blink(1)

var BlinkM DeviceType

Device type: LinkM / BlinkM

var BlinkStick DeviceType

Device type: BlinkStick

var Blync DeviceType

Device type: Blync

var BusyLightLync DeviceType

Device type: BusyLight Lync

var BusyLightUC DeviceType

Device type: BusyLight UC

var DealExtreme DeviceType

Device type: DealExtreme USBMailNotifier

var DreamCheeky DeviceType

Device type: DreamCheeky USBMailNotifier

func (DeviceType) String

func (dt DeviceType) String() string

String returns a representation of the device type

Jump to

Keyboard shortcuts

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