Exemple #1
0
func Init(brightness int) {
	if initialized {
		panic("Tower already initialized!")
	}
	initialized = true
	ws2811.Init(gpioPin, Rows*Columns, brightness)
	Queue = make(chan []ledmatrix.Color, queueSize)
	go func() { // Phantom of the Tower
		for {
			req := <-Queue
			ws2811.SetBitmap(req)
			ws2811.Render()
			ws2811.Wait()
		}
	}()
}
Exemple #2
0
func Init(brightness int) {

	background = color.RGB(0, 51, 102)
	pink1 = color.RGB(253, 151, 253)
	pink2 = color.RGB(254, 48, 150)
	salmon = color.RGB(253, 202, 153)
	catHead = color.RGB(152, 152, 152)
	catPaw = color.RGB(162, 162, 162)
	cheek = color.RGB(253, 153, 153)
	black = color.RGB(0, 0, 0)
	white = color.RGB(255, 255, 255)

	red = color.RGB(253, 0, 0)
	orange = color.RGB(253, 153, 0)
	yellow = color.RGB(254, 254, 0)
	green = color.RGB(51, 253, 0)
	blue1 = color.RGB(0, 153, 253)
	blue2 = color.RGB(102, 253, 255)

	ws2811.Init(18, 1024, brightness)
	// init background color everywhere
	for i := 0; i < 2; i++ {
		for j := 0; j < screenHeight*(2*screenWidth+motifWidth); j++ {
			Bitmap[i][j] = background
		}
	}

	Set(2, 18, 0, salmon)
	Set(2, 19, 0, salmon)
	Set(2, 20, 0, salmon)
	Set(2, 21, 0, salmon)
	Set(2, 22, 0, salmon)
	Set(2, 23, 0, salmon)
	Set(2, 24, 0, catHead)
	Set(2, 25, 0, salmon)
	Set(2, 26, 0, salmon)
	Set(2, 28, 0, catHead)

	Set(2, 18, 1, salmon)
	Set(2, 19, 1, pink2)
	Set(2, 20, 1, pink1)
	Set(2, 21, 1, pink2)
	Set(2, 22, 1, pink1)
	Set(2, 23, 1, catHead)
	Set(2, 24, 1, catHead)
	Set(2, 25, 1, catHead)
	Set(2, 26, 1, salmon)
	Set(2, 27, 1, catHead)
	Set(2, 28, 1, catHead)
	Set(2, 29, 1, catHead)

	Set(2, 18, 2, salmon)
	Set(2, 19, 2, pink1)
	Set(2, 20, 2, pink2)
	Set(2, 21, 2, pink1)
	Set(2, 22, 2, pink1)
	Set(2, 23, 2, catHead)
	Set(2, 24, 2, white)
	Set(2, 25, 2, black)
	Set(2, 26, 2, catHead)
	Set(2, 27, 2, white)
	Set(2, 28, 2, black)
	Set(2, 29, 2, catHead)

	Set(2, 18, 3, salmon)
	Set(2, 19, 3, pink1)
	Set(2, 20, 3, pink1)
	Set(2, 21, 3, pink1)
	Set(2, 22, 3, catHead)
	Set(2, 23, 3, catHead)
	Set(2, 24, 3, black)
	Set(2, 25, 3, black)
	Set(2, 26, 3, catHead)
	Set(2, 27, 3, black)
	Set(2, 28, 3, black)
	Set(2, 29, 3, catHead)
	Set(2, 30, 3, catHead)

	Set(2, 18, 4, salmon)
	Set(2, 19, 4, pink2)
	Set(2, 20, 4, pink1)
	Set(2, 21, 4, pink2)
	Set(2, 22, 4, catHead)
	Set(2, 23, 4, cheek)
	Set(2, 24, 4, cheek)
	Set(2, 25, 4, catHead)
	Set(2, 26, 4, black)
	Set(2, 27, 4, catHead)
	Set(2, 28, 4, catHead)
	Set(2, 29, 4, cheek)
	Set(2, 30, 4, cheek)

	Set(2, 18, 5, salmon)
	Set(2, 19, 5, pink1)
	Set(2, 20, 5, pink2)
	Set(2, 21, 5, pink1)
	Set(2, 22, 5, pink1)
	Set(2, 23, 5, cheek)
	Set(2, 24, 5, cheek)
	Set(2, 25, 5, black)
	Set(2, 26, 5, black)
	Set(2, 27, 5, black)
	Set(2, 28, 5, catHead)
	Set(2, 29, 5, cheek)
	Set(2, 30, 5, cheek)

	Set(2, 18, 6, salmon)
	Set(2, 19, 6, salmon)
	Set(2, 20, 6, salmon)
	Set(2, 21, 6, salmon)
	Set(2, 22, 6, salmon)
	Set(2, 23, 6, salmon)
	Set(2, 24, 6, catHead)
	Set(2, 25, 6, catHead)
	Set(2, 26, 6, catHead)
	Set(2, 27, 6, catHead)
	Set(2, 28, 6, catHead)

	Set(0, 18, 7, catPaw)
	Set(0, 21, 7, catPaw)
	Set(0, 25, 7, catPaw)
	Set(0, 28, 7, catPaw)

	Set(1, 18, 6, catPaw)
	Set(1, 17, 7, catPaw)
	Set(1, 20, 7, catPaw)
	Set(1, 24, 7, catPaw)
	Set(1, 27, 7, catPaw)

	for i := 0; i < 18; i++ {
		var delta int
		if i%6 < 3 {
			delta = 0
		} else {
			delta = 1
		}
		Set(0, i, 0+delta, red)
		Set(0, i, 1+delta, orange)
		Set(0, i, 2+delta, yellow)
		Set(0, i, 3+delta, green)
		Set(0, i, 4+delta, blue1)
		Set(0, i, 5+delta, blue2)

		Set(1, i, 1-delta, red)
		Set(1, i, 2-delta, orange)
		Set(1, i, 3-delta, yellow)
		Set(1, i, 4-delta, green)
		Set(1, i, 5-delta, blue1)
		Set(1, i, 6-delta, blue2)
	}
}