diff --git a/ufo/ufo.py b/ufo/ufo.py index ade77533..d5fa1ec5 100644 --- a/ufo/ufo.py +++ b/ufo/ufo.py @@ -1,7 +1,9 @@ -# UFO Flying Saucer with Circuit Playground Express -# https://learn.adafruit.com/ufo-circuit-playground-express/ -# Plays UFO lights and sounds if the board is upside down only, -# Tilt to change light color, cycle speed, tone pitch +""" +UFO Flying Saucer with Circuit Playground Express +https://learn.adafruit.com/ufo-circuit-playground-express/ +Plays UFO lights and sounds if the board is upside down only, +Tilt to change light color, cycle speed, tone pitch +""" import time @@ -13,8 +15,9 @@ from adafruit_circuitplayground.express import cpx pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=.8) -def simpleCircle(wait, R, G, B): # timing, color values per channel - baseFreq = int(20 + (G * 0.3)) # tone value derived from rotation +def simple_circle(wait, red, green, blue): + """timing, color values per channel""" + baseFreq = int(20 + (green * 0.3)) # tone value derived from rotation for i in range(10): pixels[i] = ((0, 0, 0)) @@ -22,7 +25,7 @@ def simpleCircle(wait, R, G, B): # timing, color values per channel time.sleep(wait) for i in range(10): - pixels[i] = ((R, G, B)) + pixels[i] = ((red, green, blue)) time.sleep(wait) @@ -41,7 +44,7 @@ while True: # check for upside down state on z axis if z < 0: # any negative number on z axis means it's upside down enough 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! pixels.fill((0, 0, 0))