From 35252346d73ab265980f24e6fe6a98e164ed348a Mon Sep 17 00:00:00 2001 From: Tim Millwood Date: Sat, 30 Jan 2021 13:40:06 +0000 Subject: [PATCH] Added a rainbow example --- examples/rainbow.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/rainbow.py diff --git a/examples/rainbow.py b/examples/rainbow.py new file mode 100644 index 0000000..9dd5770 --- /dev/null +++ b/examples/rainbow.py @@ -0,0 +1,21 @@ +import time +import ws2812b + +numpix = 30 +strip = ws2812b.ws2812b(numpix, 0,0) + +RED = (255, 0, 0) +ORANGE = (255, 165, 0) +YELLOW = (255, 150, 0) +GREEN = (0, 255, 0) +BLUE = (0, 0, 255) +INDIGO = (75, 0, 130) +VIOLET = (138, 43, 226) +COLORS = (RED, ORANGE, YELLOW, GREEN, BLUE, INDIGO, VIOLET) + +while True: + for color in COLORS: + for i in range(numpix): + strip.set_pixel(i, color[0], color[1], color[2]) + time.sleep(0.01) + strip.show()