moved wheel code
@@ -8,6 +8,20 @@ num_pixels = 30
pixels = adafruit_dotstar.DotStar(board.A1, board.A2, num_pixels, brightness=0.1, auto_write=False)
+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.
+ if pos < 0 or pos > 255:
+ return (0, 0, 0)
+ if pos < 85:
+ return (255 - pos * 3, pos * 3, 0)
+ if pos < 170:
+ pos -= 85
+ return (0, 255 - pos * 3, pos * 3)
+ pos -= 170
+ return (pos * 3, 0, 255 - pos * 3)
+
+
def slice_alternating(wait):
pixels[::2] = [RED] * (num_pixels // 2)
pixels.show()
@@ -62,20 +76,6 @@ def slice_rainbow(wait):
time.sleep(wait)
-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.
- if pos < 0 or pos > 255:
- return (0, 0, 0)
- if pos < 85:
- return (255 - pos * 3, pos * 3, 0)
- if pos < 170:
- pos -= 85
- return (0, 255 - pos * 3, pos * 3)
- pos -= 170
- return (pos * 3, 0, 255 - pos * 3)
-
-
def rainbow_cycle(wait):
for j in range(255):
for i in range(num_pixels):
