From 7e2fb83011c5e2c6e854c21f691bdbf15d44f914 Mon Sep 17 00:00:00 2001 From: Rong Date: Tue, 2 Apr 2024 19:00:51 -0700 Subject: [PATCH] apparently we needed more light patterns --- patterns.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/patterns.py b/patterns.py index d3e58d2..c423693 100644 --- a/patterns.py +++ b/patterns.py @@ -1,5 +1,6 @@ from rainbowio import colorwheel from math import sin +from random import randint frames_per_second = 12 loopcount = 0 @@ -62,4 +63,24 @@ def railgun(light): light.neopixel[pixel] = light.primary else: light.neopixel[pixel] = (0, 0, 0) + light.neopixel.show() + + +# Win a lottery ticket today +def random_a_b_colors(light): + success_weight = 50 + for pixel in range(light.PIXEL_COUNT): + value = randint(1, 100) + if value <= success_weight: + light.neopixel[pixel] = light.primary + else: + light.neopixel[pixel] = light.secondary + light.neopixel.show() + + + +def random_colors(light): + for pixel in range(light.PIXEL_COUNT): + r, g, b = randint(0, 255), randint(0, 255), randint(0, 255) + light.neopixel[pixel] = (r, g, b) light.neopixel.show() \ No newline at end of file