#Ran from raspberry pi
import board
import neopixel
import time

numOfPixels = 63
ORDER = neopixel.GRB
pixels = neopixel.NeoPixel(board.D18, numOfPixels, brightness=1, auto_write=False, pixel_order=ORDER)
pixels.show()

def wheel(pos):
    if pos < 0 or pos > 255:
        r = g = b = 0
    elif pos < 85:
        r = int(pos *3)
        g = int(255 - pos*3)
        b = 0
    elif pos < 170:
        pos -= 85
        r = int(255 - pos*3)
        g = 0
        b = int(pos*3)
    else:
        pos -= 170
        r = 0
        g = int(pos*3)
        b = int(255 - pos*3)
    return (r, g, b) if ORDER == neopixel.RGB or ORDER == neopixel.GRB else (r, g, b, 0)

def rainbow_cycle(wait):
    for j in range(255):
        for i in range(numOfPixels):
            pixel_index = (i * 256 // numOfPixels) + j
            pixels[i] = wheel(pixel_index & 255)
        pixels.show()
        time.sleep(wait)

while True:
    
    rainbow_cycle(0.001) # Change value in () to change speed of rainbow
print("led")
