blinkm

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: BSD-3-Clause Imports: 1 Imported by: 20

Documentation

Overview

Package blinkm implements a driver for the BlinkM I2C RGB LED.

Datasheet: http://thingm.com/fileadmin/thingm/downloads/BlinkM_datasheet.pdf

Index

Constants

View Source
const (
	TO_RGB            = 0x6e
	FADE_TO_RGB       = 0x63
	FADE_TO_HSB       = 0x68
	FADE_TO_RND_RGB   = 0x43
	FADE_TO_RND_HSB   = 0x48
	PLAY_LIGHT_SCRIPT = 0x70
	STOP_SCRIPT       = 0x6f
	SET_FADE          = 0x66
	SET_TIME          = 0x74
	GET_RGB           = 0x67
	GET_ADDRESS       = 0x61
	SET_ADDRESS       = 0x41
	GET_FIRMWARE      = 0x5a
)

Registers, which in the case of the BlinkM are actually commands.

View Source
const Address = 0x09

The I2C address which this device listens to.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	Address uint16
	// contains filtered or unexported fields
}

Device wraps an I2C connection to a BlinkM device.

func New

func New(bus drivers.I2C) Device

New creates a new BlinkM connection. The I2C bus must already be configured.

This function only creates the Device object, it does not touch the device.

func (*Device) Configure

func (d *Device) Configure()

Configure sets up the device for communication

func (Device) FadeToRGB

func (d Device) FadeToRGB(r, g, b byte) error

FadeToRGB sets the RGB color on the BlinkM by fading from the current color to the new color.

func (Device) GetRGB

func (d Device) GetRGB() (r, g, b byte, err error)

GetRGB gets the current RGB color on the BlinkM.

func (Device) SetRGB

func (d Device) SetRGB(r, g, b byte) error

SetRGB sets the RGB color on the BlinkM.

func (Device) StopScript

func (d Device) StopScript() error

StopScript stops whatever script is currently running on the BlinkM.

func (Device) Version

func (d Device) Version() (major, minor byte, err error)

Version returns the version of firmware on the BlinkM.

Jump to

Keyboard shortcuts

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