-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathtest-colors.py
More file actions
37 lines (32 loc) · 856 Bytes
/
test-colors.py
File metadata and controls
37 lines (32 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from machine import Pin
from neopixel import NeoPixel
from utime import sleep, ticks_ms
from urandom import randint
NEOPIXEL_PIN = 0
# This is the best number of pixels for most hats
# if you use 160 pixels/meter strips
NUMBER_PIXELS = 36
strip = NeoPixel(Pin(NEOPIXEL_PIN), NUMBER_PIXELS)
red = (255,0,0)
orange = (255,70,0)
yellow = (255,255,0)
green = (0, 255, 0)
green_med = (0,32, 0)
green_light = (0, 8, 0)
blue = (0,0,255)
off = (0, 0, 0)
orange = (140, 60, 0)
white = (255, 255, 255)
colors = (red, orange, yellow, green, blue)
color_count = len(colors)
levels = [255, 128, 64, 32, 16, 8, 4, 2, 1]
level_count = len(levels)
def solid_color(color, delay):
for i in range(0, NUMBER_PIXELS-1):
strip[i] = color;
strip.write()
sleep(delay)
while True:
solid_color(red, 1)
solid_color(white, 1)
solid_color(blue, 1)