dmx

package module
v0.0.0-...-9491cfa Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2015 License: MIT Imports: 5 Imported by: 1

README

DMX

Build Status Godoc

DMX output control for Gobot.

DMX512 (Digital Multiplex) is a standard for digital communication networks that are commonly used to control stage lighting and effects. It was originally intended as a standardized method for controlling light dimmers, which, prior to DMX512, had employed various incompatible proprietary protocols. It soon became the primary method for linking controllers (such as a lighting console) to dimmers and special effects devices such as fog machines and intelligent lights. DMX has also expanded to uses in non-theatrical interior and architectural lighting, at scales ranging from strings of Christmas lights to electronic billboards. DMX can now be used to control almost anything, reflecting its popularity in theatres and venues.

Install

go get github.com/lucibus/dmx

Usage

We currently only support the ENTTEC DMX USB Pro for outputting DMX signals. Please open issues or send PRs for other outputs that you want to support.

You need to install the drivers for that device, so that it shows up as serial device. On my mac I had to follow this tutorial and then it appeared as /dev/tty.usbserial-EN158833.

Check out example/main.go for example usage.

Testing

To run the unit tests just use go test.

If you have the device working, you can do a full integration test with

go run example/main.go

You will likely have to modify the path to the port in the example file first. This will randomly change the level of output address one every three seconds.

Documentation

Index

Constants

View Source
const MaxUniverseSize = 512

MaxUniverseSize is the most number of DMX addresses the device can output.

View Source
const MinUniverseSize = 24

MinUniverseSize is the lowest number of DMX addresses the device can output.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adaptor

type Adaptor interface {
	gobot.Adaptor
	OutputDMX(data map[int]byte, universeSize int) error
}

Adaptor is anything that can output DMX.

type DebugAdaptor

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

DebugAdaptor is a debugging DMX adaptor. It will set the Use the GetLastOuput and GetLastUniverseSize attributes to get the last values set by `OutputDMX` is called, so you can check them for debugging purposes

func NewDebugAdaptor

func NewDebugAdaptor() *DebugAdaptor

NewDebugAdaptor returns a new DebugAdaptor

func (*DebugAdaptor) Connect

func (a *DebugAdaptor) Connect() (errs []error)

Connect is a noop.

func (*DebugAdaptor) Finalize

func (a *DebugAdaptor) Finalize() (errs []error)

Finalize is a noop.

func (*DebugAdaptor) GetLastOutput

func (a *DebugAdaptor) GetLastOutput() map[int]byte

GetLastOutput returns the last output set.

func (*DebugAdaptor) GetLastUniverseSize

func (a *DebugAdaptor) GetLastUniverseSize() int

GetLastUniverseSize returns the last univserse size set.

func (*DebugAdaptor) Name

func (a *DebugAdaptor) Name() string

Name is "Debug Adaptor".

func (*DebugAdaptor) OutputDMX

func (a *DebugAdaptor) OutputDMX(output map[int]byte, universeSize int) error

OutputDMX sets just records the values.

type Driver

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

Driver represents a DMX USB Pro

func NewDriver

func NewDriver(a *USBEnttecProAdaptor, name string) *Driver

NewDriver returns a new Driver given an Adaptor and name.

Adds the following API Commands:

"OutputDMX" - See Driver.OutputDMX
"SetUniverseSize" - See Driver.SetUniverseSize

func (*Driver) Connection

func (s *Driver) Connection() gobot.Connection

Connection returns the connection

func (*Driver) Halt

func (s *Driver) Halt() []error

Halt stops the connection.

func (*Driver) Name

func (s *Driver) Name() string

Name returns the name

func (*Driver) OutputDMX

func (s *Driver) OutputDMX(data map[int]byte) error

OutputDMX outputs the mapping of DMX addresses and values.

All addresses not provided will be set to the lowest value, up the the maximum address, which is the universe size.

func (*Driver) SetUniverseSize

func (s *Driver) SetUniverseSize(size int) error

SetUniverseSize sets the universe size of the output.

It has a minumum size of 12 and max size of 512.

func (*Driver) Start

func (s *Driver) Start() []error

Start starts the connection

type InvalidAddressError

type InvalidAddressError struct {
	Address      int
	UniverseSize int
}

InvalidAddressError is raised when you call `OutputDMX` with an address that is out of range. Either below 1 or above the universe size.

func (*InvalidAddressError) Error

func (e *InvalidAddressError) Error() string

type InvalidUniverseSizeError

type InvalidUniverseSizeError struct {
	UniverseSize int
}

InvalidUniverseSizeError is raised when you call `SetUniverseSize` with a universe size below `MinUniverseSize` or above `MaxUniverseSize`

func (*InvalidUniverseSizeError) Error

func (e *InvalidUniverseSizeError) Error() string

type NotConnectedError

type NotConnectedError struct{}

NotConnectedError is raised when you call `OutputDMX` before calling `Connect`

func (*NotConnectedError) Error

func (*NotConnectedError) Error() string

type USBEnttecProAdaptor

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

USBEnttecProAdaptor represents a Connection to a DMX USB Pro

func NewUSBEnttecProAdaptor

func NewUSBEnttecProAdaptor(name string, port string) *USBEnttecProAdaptor

NewUSBEnttecProAdaptor returns a new Adaptor given a name and port

func (*USBEnttecProAdaptor) Connect

func (a *USBEnttecProAdaptor) Connect() (errs []error)

Connect initiates a connection.

func (*USBEnttecProAdaptor) Finalize

func (a *USBEnttecProAdaptor) Finalize() (errs []error)

Finalize closes the connection.

func (*USBEnttecProAdaptor) Name

func (a *USBEnttecProAdaptor) Name() string

Name returns the name.

func (*USBEnttecProAdaptor) OutputDMX

func (a *USBEnttecProAdaptor) OutputDMX(data map[int]byte, universeSize int) error

OutputDMX outputs the mapping of DMX addresses and values.

All addresses not provided will be set to the lowest value, up the the maximum address, which is the universe size.

func (*USBEnttecProAdaptor) Port

func (a *USBEnttecProAdaptor) Port() string

Port returns the port.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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