forked from proto-pic/micro-bit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRandomColours.py
31 lines (29 loc) · 914 Bytes
/
RandomColours.py
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
from microbit import *
import neopixel
from random import randint
# Setup the Neopixel strip on pin0 with a length of 4 pixels
np = neopixel.NeoPixel(pin0, 32)
while True:
for thisloop in range(0,100):
for pixel_id in range(0, 32):
red = randint(0, 50)
green = randint(0, 50)
blue = randint(0, 50)
np[pixel_id] = (red, green, blue)
np.show()
sleep(randint(10,100))
for colour in range (0,128):
for pixel_id in range(0, 32):
np[pixel_id] = (colour, 0, 0)
np.show()
sleep(10)
for colour in range (0,128):
for pixel_id in range(0, 32):
np[pixel_id] = (128 - colour, colour, 0)
np.show()
sleep(10)
for colour in range (0,128):
for pixel_id in range(0, 32):
np[pixel_id] = (0, 128-colour, colour)
np.show()
sleep(10)