A simple library to control the Luxafor Flag.
For rainbow radness
go get -v -u github.com/leosunmo/goluxafor/example/rainbow
rainbow
Quick 'n dirty CLI
go get -v -u github.com/leosunmo/goluxafor/example/luxcli
$ luxcli red
$ luxcli green
$ luxcli off
package main
import (
"github.com/leosunmo/goluxafor"
)
func main() {
luxafor := goluxafor.NewLuxafor()
luxafor.Pattern(goluxafor.Pattern8, 0)
luxafor.Close()
}
goluxafor.LedAll
- All LEDsgoluxafor.LedA
- Back sidegoluxafor.LedB
- Flag sidegoluxafor.Led1
- Lower flaggoluxafor.Led2
- Middle flaggoluxafor.Led3
- Top flaggoluxafor.Led4
- Lower backgoluxafor.Led5
- Middle backgoluxafor.Led6
- Top back
Set whole flag to red colour and set fadeTime
to a non-zero value up to 255 to control the fade speed.
luxafor.Colour(goluxafor.ledAll, 255, 0, 0, fadeTime)
Also works for individual LEDs.
Strobe can be set on individual LEDs, sides or all.
Set strobe frequency with speed
and number of repeats with repeat
, 0
is forever.
luxafor.Strobe(goluxafor.LedAll, randomColour(), randomColour(), randomColour(), speed, repeat)
Wave is executed on the whole flag and has 5 different wave patterns.
Set wave change speed with speed
and number of repetitions with repeat
, 0
is forever.
luxafor.Wave(goluxafor.Wave2, randomColour(), randomColour(), randomColour(), speed, repeat)
Patterns are pre-programmed patterns on the device itself that are executed on all LEDs.
You can only specify the pattern type and repeat
. Again, 0
will loop the pattern forever.
luxafor.Pattern(goluxafor.Pattern5, 0) // Loop police lights forever
Patterns:
goluxafor.Pattern1
- Traffic lightsgoluxafor.Pattern2
- Colour walkgoluxafor.Pattern3
- Random patterngoluxafor.Pattern4
- Random fading patterngoluxafor.Pattern5
- Police patterngoluxafor.Pattern6
- Random quick fade patterngoluxafor.Pattern7
- Colourful police patterngoluxafor.Pattern8
- Quick rainbow pattern