Documentation ¶
Index ¶
- Constants
- Variables
- func Center(dev Device, img draw.Image)
- func DisplayCanvas(img image.Image, device Device) error
- func DisplayGrid(grid [][]int, device Device) error
- func IsOff(c color.Color) bool
- func IsOn(c color.Color) bool
- func NewCanvas() draw.Image
- func Scroll(dev Device, img draw.Image)
- type Device
Examples ¶
Constants ¶
View Source
const ( DeviceHeight = 7 DeviceWidth = 21 )
View Source
const ( VendorID = 0x1d34 ProductID = 0x0013 ManufacturerString = "Dream Link" ProductString = "USB LED Message Board v1.0" Version = 0x01 SerialNumber = 1 )
USB Descriptor Information
View Source
const MinimumRefreshRate = 400 * time.Millisecond
Variables ¶
View Source
var ( On = color.RGBA{0xff, 0x00, 0x00, 0xff} // red Off = color.RGBA{0x00, 0x00, 0x00, 0xff} // black )
Colors used when displaying Canvas as image.
View Source
var MonochromeModel = color.ModelFunc(monochromeModel)
MonochromeModel can convert any Color to colours On or Off. The conversion is lossy!
Functions ¶
func DisplayCanvas ¶
DisplayCanvas displays an image.Image on the Dream Cheeky Message board. Pixels of color #ff0000 (On) will turn the respective leds on, other color will turn them off.
func DisplayGrid ¶
DisplayGrid displays an 21 x 7 grid on a Dream Cheeky Message board (device)
Example ¶
var list = hid.Enumerate(VendorID, ProductID) if len(list) == 0 { println("Could not find USB device! Is it plugged in?") return } // Use first device device, err := list[0].Open() if err != nil { panic(err) } println(fmt.Sprintf("Connected to %s %s", device.Manufacturer, device.Product)) grid := [][]int{ {1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0}, {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0}, {1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0}, {1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1}, {0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0}, } for { _ = DisplayGrid(grid, device) time.Sleep(MinimumRefreshRate) }
Output:
Types ¶
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
Package fonts provides functions to write text in specific fonts to an image which can then be display on the LED message board.
|
Package fonts provides functions to write text in specific fonts to an image which can then be display on the LED message board. |
generator
This program generates fonts.
|
This program generates fonts. |
Click to show internal directories.
Click to hide internal directories.