Autoformat Unicorn Horn
MODIFY
3D_Printed_Unicorn_Horn/3D_Printed_Unicorn_Horn.py
3D_Printed_Unicorn_Horn/3D_Printed_Unicorn_Horn.py
@@ -11,6 +11,7 @@ led.direction = Direction.OUTPUT
strip = neopixel.NeoPixel(pixpin, numpix, brightness=1, auto_write=True)
+
def wheel(pos):
# Input a value 0 to 255 to get a color value.
# The colours are a transition r - g - b - back to r.
@@ -25,6 +26,7 @@ def wheel(pos):
pos -= 170
return (0, int(pos*3), int(255 - pos*3))
+
def rainbow_cycle(wait):
for j in range(255*5):
for i in range(len(strip)):
@@ -32,11 +34,13 @@ def rainbow_cycle(wait):
strip[i] = wheel(idx & 255)
time.sleep(wait)
+
def rainbow(wait):
for j in range(255):
for i in range(len(strip)):
idx = int(i+j)
strip[i] = wheel(idx & 255)
+
while True:
rainbow_cycle(0.05)

Autoformat Unicorn Horn