]>
vault307.fbx.one Git - random.git/blob - letITglow.py
1 from machine
import Pin
2 from neopixel
import NeoPixel
10 seg5
= Pin(4, Pin
.OUT
)
11 seg6
= Pin(6, Pin
.OUT
)
13 # Create a list of our LEDs
14 segments
= [seg1
, seg2
, seg3
, seg4
, seg5
, seg6
]
17 greenbtn
= Pin(14, Pin
.IN
, Pin
.PULL_DOWN
)
18 redbtn
= Pin(15, Pin
.IN
, Pin
.PULL_DOWN
)
20 # Define the strip pin number (2) and number of LEDs (12)
21 ring
= NeoPixel(Pin(16), 12)
30 # For loop to turn each LED on then off in order of the list
37 # For loop in reverse, running backwards through the list
38 for led
in reversed (segments
):
44 # Create random RGB values
45 r
= random
.randint(0,100)
46 g
= random
.randint(0,100)
47 b
= random
.randint(0,100)
51 # Light each LED a random colour
55 # Show the LED for this long
58 #Clear the ring at the end of each loop