leds

package
v0.0.0-...-c6c79d5 Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TODO: bbox testing
	// 2x structure
	BAUX_STRAND_COUNT1 = 1
	BAUX_STRAND_LEN1   = 85

	// 1x globe
	BAUX_STRAND_COUNT2 = 4
	BAUX_STRAND_LEN2   = 60

	BAUX_LED_COUNT1 = BAUX_STRAND_COUNT1 * BAUX_STRAND_LEN1 // 5*30 // 30/m
	BAUX_LED_COUNT2 = BAUX_STRAND_COUNT2 * BAUX_STRAND_LEN2 // 4*60 // 60/m

	DEFAULT_INTERVAL_MS = 2000

	BAUX_STREAK_LENGTH = BAUX_LED_COUNT1 * 3 / 4
)
View Source
const (
	LED_FREQ     = 1200000
	LED_COUNT    = 300
	FREEFORM_IDX = 188
	TICK_DELAY   = 6 // match sound to LEDs
	SINE_PERIOD  = 5
)
View Source
const (
	// TODO: bbox testing
	// 2x structure
	CRANE_STRAND_COUNT1 = 5
	CRANE_STRAND_LEN1   = 30

	// 1x heart
	CRANE_STRAND_COUNT2 = 4
	CRANE_STRAND_LEN2   = 60

	CRANE_LED_COUNT1 = CRANE_STRAND_COUNT1 * CRANE_STRAND_LEN1 // 10*30 // * 2x(10) // 30/m
	CRANE_LED_COUNT2 = CRANE_STRAND_COUNT2 * CRANE_STRAND_LEN2 // 8*60 // * 1x(4 + 4) // 60/m

	BPM      = 36
	INTERVAL = 60 * time.Second / BPM / 2 // (36 beats/min) / 2 color transitions/beat

	LIGHT_COUNT = 18 // 2 x 18 == 36 total trueWhite lights turned on at a time

	STREAK_LENGTH = 30
	STREAK_STEP   = 0.1

	// TODO: unused?
	CRANE_COLOR_WEIGHT = 0.01
)
View Source
const (
	// 2x undercarriage strands
	CRAWLER_STRAND_COUNT1 = 4
	CRAWLER_STRAND_LEN1   = 60

	CRAWLER_LED_COUNT1 = CRAWLER_STRAND_COUNT1 * CRAWLER_STRAND_LEN1 // 4*60 // * 2x(4) // 60/m

	// TODO: make transition time-based rather than fast as possible?
	// lower weight == slower transitions
	// crawler has fewer LEDs than fish == faster iterations
	CRAWLER_COLOR_WEIGHT = 0.005
)
View Source
const (
	// 2x side fins
	STRAND_COUNT1 = 5
	STRAND_LEN1   = 144

	// 1x top and back fins
	STRAND_COUNT2 = 10
	STRAND_LEN2   = 60

	LED_COUNT1 = STRAND_COUNT1 * STRAND_LEN1 // 5*144 // * 2x(5) // 144/m
	LED_COUNT2 = STRAND_COUNT2 * STRAND_LEN2 // 10*60 // * 1x(4 + 2 + 4) // 60/m

	AMPLITUDE_FACTOR = 0.75
)
View Source
const (
	DEFAULT_FREQ = 800000
	GPIO_PIN1A   = 18  // PWM0, must be 18 or 12
	GPIO_PIN1B   = 12  // PWM0, must be 18 or 12
	GPIO_PIN2    = 13  // PWM1, must be 13 for rPI 3
	BRIGHTNESS   = 255 // 0-255
)

Variables

View Source
var (
	RED_LIGHT_RANGE = []uint32{0, 1, 2, 3, 4}
)

Functions

func Clear

func Clear(ledCount1 int, ledCount2 int)

Turn off all LEDs

func InitLeds

func InitLeds(freq int, ledCount1 int, ledCount2 int)

func SetLed

func SetLed(channel int, led int)

func Shutdown

func Shutdown()

Types

type Baux

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

func InitBaux

func InitBaux(level <-chan float64, w *web.Web) *Baux

func (*Baux) Close

func (c *Baux) Close()

func (*Baux) Run

func (c *Baux) Run()

type Crane

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

func InitCrane

func InitCrane(level <-chan float64) *Crane

func (*Crane) Close

func (c *Crane) Close()

func (*Crane) Run

func (c *Crane) Run()

type Crawler

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

func InitCrawler

func InitCrawler(level <-chan float64, press <-chan struct{}, w *web.Web) *Crawler

func (*Crawler) Close

func (c *Crawler) Close()

func (*Crawler) Run

func (c *Crawler) Run()

type Fish

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

func InitFish

func InitFish(level <-chan float64, press <-chan struct{}) *Fish

func (*Fish) Close

func (f *Fish) Close()

func (*Fish) Run

func (f *Fish) Run()

type LedBeats

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

func InitLedBeats

func InitLedBeats(
	msgs <-chan bbox.Beats,
	ticks <-chan int,
	intervalCh <-chan bbox.Interval,
) *LedBeats

func (*LedBeats) Close

func (l *LedBeats) Close()

func (*LedBeats) Run

func (l *LedBeats) Run()

type Row

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

func (*Row) TickToLed

func (r *Row) TickToLed(tick int, ticksPerBeat int) (buttonIdx int, peak float64)

TODO: cache?

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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