cube

package module
v0.0.0-...-6e92df3 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2016 License: MIT Imports: 7 Imported by: 3 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-cube

Client API for Amperka Cube in Golang

GoDoc

API

Please have a look at the GoDoc documentation for a detailed API description.

Example

package main

import (
	"fmt"
	"github.com/kapitanov/go-cube"
)

func main() {
  c, err := cube.NewCube(cube.AutoDetectPort)
	if err != nil {
		panic(err)
	}
	
	fmt.Print("Cube is RED\n")
	c.Red()
	
	fmt.Print("Cube is GREEN\n")
	c.Green()
	
	fmt.Print("Cube is BLINKING FAST IN RED AND GREEN\n")
	c.Blink(cube.BlinkFast | cube.BlinkRed | cube.BlinkGreen)
	
	fmt.Print("Cube is OFF\n")
	c.Off()
}

Documentation

Index

Constants

View Source
const AutoDetectPort = autoDetectPort

AutoDetectPort is a placeholder port name for Cube port auto detection

Variables

This section is empty.

Functions

func SetLogWriter

func SetLogWriter(w io.Writer)

SetLogWriter sets log writer for go-cube

Types

type BlinkMode

type BlinkMode int

BlinkMode defines option flags for cube blinkin mode

const (
	// BlinkFast enables fast blinking
	BlinkFast BlinkMode = 0x01
	// BlinkSlow enables slow blinking
	BlinkSlow BlinkMode = 0x02

	// BlinkRed enables red LEDs blinking
	BlinkRed BlinkMode = 0x10
	// BlinkGreen enables green LEDs blinking
	BlinkGreen BlinkMode = 0x20
)

type Cube

type Cube interface {
	// Off turns Cube off
	Off() error

	// Red turns Cube red
	Red() error

	// Green turns Cube green
	Green() error

	// Blink makes Cube blink several times
	Blink(mode BlinkMode) error

	// Close disconnects client from, Cube
	Close()
}

Cube is interface of Cube client

func NewCube

func NewCube(port string) (Cube, error)

NewCube creates new Cube client

Directories

Path Synopsis
examples
cube command

Jump to

Keyboard shortcuts

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