Permalink
Browse files

Fix Flake8 issues

  • Loading branch information...
craigargh committed May 14, 2018
1 parent 08cb52f commit df581b6d7fd489f65fe4076d49fad8a9556c183b
@@ -51,7 +51,7 @@
pass # wait for it to be released!
# type the keycode or string
k = buttonkeys[i] # get the corresp. keycode/str
if type(k) is str:
if isinstance(k, str):
layout.write(k)
else:
kbd.press(controlkey, k) # press...
@@ -16,9 +16,9 @@ def wheel(pos):
# The colours are a transition r - g - b - back to r.
if (pos < 0) or (pos > 255):
return (0, 0, 0)
if (pos < 85):
if pos < 85:
return (int(pos * 3), int(255 - (pos * 3)), 0)
elif (pos < 170):
elif pos < 170:
pos -= 85
return (int(255 - pos * 3), 0, int(pos * 3))
else:
@@ -1,8 +1,8 @@
# Gemma IO demo - USB/Serial echo
import busio
from board import *
from digitalio import *
from board import D0, D2, D13
from digitalio import DigitalInOut, Direction
led = DigitalInOut(D13)
led.direction = Direction.OUTPUT
@@ -27,32 +27,27 @@
pixels = neopixel.NeoPixel(pixpin, numpix, brightness=.3, auto_write=False)
def setup():
prevtime = time.monotonic()
setup()
prevtime = time.monotonic()
while True:
i = 0
t = 0
# Random sparks - just one LED on at a time!
if (mode == 0):
if mode == 0:
i = random.randint(0, (numpix - 1))
pixels[i] = color
pixels.write()
time.sleep(0.01)
pixels[i] = (0, 0, 0)
# Spinny wheels (8 LEDs on at a time)
elif (mode == 1):
elif mode == 1:
for i in range(0, numpix):
c = 0
# 4 pixels on...
if (((offset + i) & 7) < 2):
if ((offset + i) & 7) < 2:
c = color
pixels[i] = c # First eye
@@ -64,12 +59,12 @@ def setup():
t = time.monotonic()
if ((t - prevtime) > 8): # Every 8 seconds...
if (t - prevtime) > 8: # Every 8 seconds...
mode += 1 # Next mode
if (mode > 1): # End of modes?
if mode > 1: # End of modes?
mode = 0 # Start modes over
if (rgb_idx > 2): # reset R-->G-->B rotation
if rgb_idx > 2: # reset R-->G-->B rotation
rgb_idx = 0
color = rgb_colors[rgb_idx] # next color assignment
@@ -15,7 +15,7 @@
strip[pos] = ([255, 48, 0]) # brightest
strip[pos + 1] = ([128, 0, 0]) # Medium red
if ((pos + 2) < numpix):
if (pos + 2) < numpix:
# Dark red, do not exceed number of pixels
strip[pos + 2] = ([16, 0, 0])
@@ -26,14 +26,14 @@
# it's easier to erase it all and draw a new one next time.
for j in range(-2, 2):
strip[pos + j] = (0, 0, 0)
if ((pos + 2) < numpix):
if (pos + 2) < numpix:
strip[pos + 2] = (0, 0, 0)
# Bounce off ends of strip
pos += direction
if (pos < 0):
if pos < 0:
pos = 1
direction = -direction
elif (pos >= (numpix - 1)):
elif pos >= (numpix - 1):
pos = numpix - 2
direction = -direction

0 comments on commit df581b6

Please sign in to comment.