import buttons
import defines
import time
import system
import rgb, display

def input_b(pressed):
    if pressed:
        system.reboot()

buttons.register(defines.BTN_B, input_b)

rgb.background((0,0,0))
rgb.clear()

def drawVertLine(x, color):
    for y in range(8):
        rgb.pixel(color, (x,y))

while True:
    for x in range(0, 36):
        drawVertLine(x-0, (0xFF, 0, 0))
        drawVertLine(x-1, (0xEA, 0, 0))
        drawVertLine(x-2, (0xD5, 0, 0))
        drawVertLine(x-3, (0xC0, 0, 0))
        drawVertLine(x-4, (0xAB, 0, 0))
        drawVertLine(x-5, (0x96, 0, 0))
        drawVertLine(x-6, (0x81, 0, 0))
        drawVertLine(x-7, (0x6C, 0, 0))
        drawVertLine(x-8, (0x57, 0, 0))
        drawVertLine(x-9, (0x47, 0, 0))
        drawVertLine(x-10, (0x2D, 0, 0))
        drawVertLine(x-11, (0x18, 0, 0))
        drawVertLine(x-12, (0x30, 0, 0))
        drawVertLine(x-13, (0x00, 0, 0))
        time.sleep(0.025)
        rgb.clear()


    for x in range(32, -4, -1):
        drawVertLine(x+0, (0xFF, 0, 0))
        drawVertLine(x+1, (0xEA, 0, 0))
        drawVertLine(x+2, (0xD5, 0, 0))
        drawVertLine(x+3, (0xC0, 0, 0))
        drawVertLine(x+4, (0xAB, 0, 0))
        drawVertLine(x+5, (0x96, 0, 0))
        drawVertLine(x+6, (0x81, 0, 0))
        drawVertLine(x+7, (0x6C, 0, 0))
        drawVertLine(x+8, (0x57, 0, 0))
        drawVertLine(x+9, (0x47, 0, 0))
        drawVertLine(x+10, (0x2D, 0, 0))
        drawVertLine(x+11, (0x18, 0, 0))
        drawVertLine(x+12, (0x30, 0, 0))
        drawVertLine(x+13, (0x00, 0, 0))
        time.sleep(0.025)
        rgb.clear()