#!/usr/bin/env python3

import time
from neopixel import *

numrows = 16
ledsrow = 18
numleds = numrows * ledsrow

PIN         = 18     # GPIO 18 / PIN 12
BRIGHTNESS  = 255    # min 0 / max 255

stick = Adafruit_NeoPixel(numleds, PIN, 800000, 5, False, BRIGHTNESS)
stick.begin()

white = Color(0,0,0)
red   = Color(0,255,0)
blue  = Color(0,0,255)

backgroundarray = []
for i in range (0, numleds):
    backgroundarray.append (i)
    backgroundarray[i]=white

try:
    while True:
        for i in range (0, 16):
            foregroundarray=list(backgroundarray)
            for j in range (0,18):
                foregroundarray [     (i*18+j)%numleds] = red
                foregroundarray [ ((i+8)*18+j)%numleds] = blue
            for j in range (0, numleds):
                stick.setPixelColor(j,foregroundarray [j])
            stick.show()
            time.sleep(5)

except:
    print ("exit")