Skip to content

Instantly share code, notes, and snippets.

@sat0ken
Created December 5, 2017 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sat0ken/777af058d1d68ad02395b9c804057f9d to your computer and use it in GitHub Desktop.
Save sat0ken/777af058d1d68ad02395b9c804057f9d to your computer and use it in GitHub Desktop.
from machine import Pin
from neopixel import NeoPixel
import time, random
np = NeoPixel(Pin(5), 20, bpp=3)
step = 32
def light_on():
while True:
for i in range(20):
for j in range(20):
np[j] = tuple(( max(0, val - step) for val in np[j]))
r = random.randint(0, 255)
g = random.randint(0, 255)
b = random.randint(0, 255)
np[i] = (r, g, b)
np.write()
time.sleep(0.05)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment