diff --git a/3D_Printed_LED_Microphone_Flag/3D_Printed_LED_Microphone_Flag.py b/3D_Printed_LED_Microphone_Flag/3D_Printed_LED_Microphone_Flag.py index c735c9c9f..b9fb34347 100644 --- a/3D_Printed_LED_Microphone_Flag/3D_Printed_LED_Microphone_Flag.py +++ b/3D_Printed_LED_Microphone_Flag/3D_Printed_LED_Microphone_Flag.py @@ -55,10 +55,10 @@ strip = neopixel.NeoPixel(led_pin, n_pixels, brightness=1, auto_write=False) def wheel(pos): # Input a value 0 to 255 to get a color value. # The colours are a transition r - g - b - back to r. - if (pos < 0) or (pos > 255): + if pos < 0 or pos > 255: return (0, 0, 0) if pos < 85: - return (int(pos * 3), int(255 - (pos * 3)), 0) + return (int(pos * 3), int(255 - (pos*3)), 0) elif pos < 170: pos -= 85 return (int(255 - pos * 3), 0, int(pos * 3)) @@ -124,10 +124,11 @@ def fscale(originalmin, originalmax, newbegin, newend, inputvalue, curve): if invflag == 0: rangedvalue = (pow(normalizedcurval, curve) * newrange) + newbegin - else: # invert the ranges + else: # invert the ranges rangedvalue = newbegin - (pow(normalizedcurval, curve) * newrange) return rangedvalue + return rangedvalue def drawLine(fromhere, to): diff --git a/3D_Printed_NeoPixel_Ring_Hair_Dress/3D_Printed_NeoPixel_Ring_Hair_Dress.py b/3D_Printed_NeoPixel_Ring_Hair_Dress/3D_Printed_NeoPixel_Ring_Hair_Dress.py index c5cd5a459..e7d460241 100644 --- a/3D_Printed_NeoPixel_Ring_Hair_Dress/3D_Printed_NeoPixel_Ring_Hair_Dress.py +++ b/3D_Printed_NeoPixel_Ring_Hair_Dress/3D_Printed_NeoPixel_Ring_Hair_Dress.py @@ -163,9 +163,9 @@ def nextspectrumcolor(): # spectral wipe from green to red if spectrum_part == 2: - color = (color_idx, 0, 255 - color_idx) + color = (color_idx, 0, 255-color_idx) color_idx += curr_color_granularity - if (color_idx > 255): + if color_idx > 255: spectrum_part = 0 color_idx = 0 diff --git a/3D_Printed_Unicorn_Horn/3D_Printed_Unicorn_Horn.py b/3D_Printed_Unicorn_Horn/3D_Printed_Unicorn_Horn.py index 33efcf821..7a526c9a9 100644 --- a/3D_Printed_Unicorn_Horn/3D_Printed_Unicorn_Horn.py +++ b/3D_Printed_Unicorn_Horn/3D_Printed_Unicorn_Horn.py @@ -18,9 +18,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): - return (int(pos * 3), int(255 - (pos * 3)), 0) - elif (pos < 170): + if pos < 85: + return (int(pos * 3), int(255 - (pos*3)), 0) + elif pos < 170: pos -= 85 return (int(255 - pos * 3), 0, int(pos * 3)) else: @@ -41,6 +41,7 @@ def rainbow(wait): for i in range(len(strip)): idx = int(i + j) strip[i] = wheel(idx & 255) + time.sleep(wait) while True: