Update main.py

fixed for pylint, now passes locally, please re-PR @djecken
This commit is contained in:
John Edgar Park 2018-10-09 13:29:48 -07:00 committed by GitHub
parent 8dd4b97d01
commit 515dd258e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,8 @@
import time, random import time
import random
import board import board
import digitalio
from board import SCL, SDA from board import SCL, SDA
import digitalio
import busio import busio
from adafruit_neotrellis.neotrellis import NeoTrellis from adafruit_neotrellis.neotrellis import NeoTrellis
@ -39,13 +40,13 @@ def blink(event):
if event.edge == NeoTrellis.EDGE_RISING: if event.edge == NeoTrellis.EDGE_RISING:
if button.value: if button.value:
trellis.pixels[event.number] = WHITE trellis.pixels[event.number] = WHITE
else: else:
for i in range(16): for j in range(16):
trellis.pixels[i] = ANIM_COLOR trellis.pixels[j] = ANIM_COLOR
time.sleep(.05) time.sleep(.05)
trellis.pixels[i] = OFF trellis.pixels[j] = OFF
time.sleep(.05) time.sleep(.05)
# turn the LED off when a rising edge is detected # turn the LED off when a rising edge is detected
elif event.edge == NeoTrellis.EDGE_FALLING: elif event.edge == NeoTrellis.EDGE_FALLING:
trellis.pixels[event.number] = random.choice([RED, YELLOW, GREEN, CYAN, BLUE, PURPLE]) trellis.pixels[event.number] = random.choice([RED, YELLOW, GREEN, CYAN, BLUE, PURPLE])
@ -70,4 +71,4 @@ while True:
# call the sync function call any triggered callbacks # call the sync function call any triggered callbacks
trellis.sync() trellis.sync()
# the trellis can only be read every 17 millisecons or so # the trellis can only be read every 17 millisecons or so
time.sleep(.02) time.sleep(.02)