from machine import Pin
from neopixel import NeoPixel
from time import sleep
from math import sin, pi
NUM_LEDS=64
d = 256//NUM_LEDS
pixels = NeoPixel(Pin(2), NUM_LEDS)
dd=0
while True:
for i in range(NUM_LEDS/4+1):
pixels[i] = (255,dd,0)
pixels[NUM_LEDS//2-i] = (255,dd,0)
pixels[NUM_LEDS//2+i] = (255,dd,0)
pixels[-i] = (255,dd,0)
pixels.write()
#sleep(0.1)
dd=dd+10*d
while True:
for i in range(NUM_LEDS):
for j in range(0,256,16):
pixels[i] = (240-j,dd,0)
pixels.write()
for j in range(0,256,16):
pixels[i] = (240-j,dd,0)
pixels.write()
#sleep(0.1)
dd=dd+d
red=green=blue=40
while True:
for i in range(NUM_LEDS):
red = red + 30
if red>255:
red = 40
green = green + 50
if green>255:
green = 40
blue = blue + 40
if blue>255:
blue = 40
color=(red,green,blue)
print(color, end="")
pixels[i] = color
pixels.write()
print(sin(i*2*pi/NUM_LEDS))
sleep(0.15+0.15*sin(i*2*pi/NUM_LEDS))