Fix pylint issues
This commit is contained in:
parent
707fa4ff24
commit
4bc3226be1
1 changed files with 11 additions and 8 deletions
19
ufo/ufo.py
19
ufo/ufo.py
|
|
@ -1,7 +1,9 @@
|
||||||
# UFO Flying Saucer with Circuit Playground Express
|
"""
|
||||||
# https://learn.adafruit.com/ufo-circuit-playground-express/
|
UFO Flying Saucer with Circuit Playground Express
|
||||||
# Plays UFO lights and sounds if the board is upside down only,
|
https://learn.adafruit.com/ufo-circuit-playground-express/
|
||||||
# Tilt to change light color, cycle speed, tone pitch
|
Plays UFO lights and sounds if the board is upside down only,
|
||||||
|
Tilt to change light color, cycle speed, tone pitch
|
||||||
|
"""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
@ -13,8 +15,9 @@ from adafruit_circuitplayground.express import cpx
|
||||||
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=.8)
|
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=.8)
|
||||||
|
|
||||||
|
|
||||||
def simpleCircle(wait, R, G, B): # timing, color values per channel
|
def simple_circle(wait, red, green, blue):
|
||||||
baseFreq = int(20 + (G * 0.3)) # tone value derived from rotation
|
"""timing, color values per channel"""
|
||||||
|
baseFreq = int(20 + (green * 0.3)) # tone value derived from rotation
|
||||||
|
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
pixels[i] = ((0, 0, 0))
|
pixels[i] = ((0, 0, 0))
|
||||||
|
|
@ -22,7 +25,7 @@ def simpleCircle(wait, R, G, B): # timing, color values per channel
|
||||||
time.sleep(wait)
|
time.sleep(wait)
|
||||||
|
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
pixels[i] = ((R, G, B))
|
pixels[i] = ((red, green, blue))
|
||||||
time.sleep(wait)
|
time.sleep(wait)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -41,7 +44,7 @@ while True:
|
||||||
# check for upside down state on z axis
|
# check for upside down state on z axis
|
||||||
if z < 0: # any negative number on z axis means it's upside down enough
|
if z < 0: # any negative number on z axis means it's upside down enough
|
||||||
speed = (0.01 * (B * 0.025))
|
speed = (0.01 * (B * 0.025))
|
||||||
simpleCircle(speed, R, G, B) # speed based on tilt, .01 is good start
|
simple_circle(speed, R, G, B) # speed based on tilt, .01 is good start
|
||||||
|
|
||||||
else: # right side up means no colors or sound!
|
else: # right side up means no colors or sound!
|
||||||
pixels.fill((0, 0, 0))
|
pixels.fill((0, 0, 0))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue