Merge branch 'master' into pylint

# Conflicts:
#	3D_Printed_LED_Microphone_Flag/3D_Printed_LED_Microphone_Flag.py
#	3D_Printed_NeoPixel_Gas_Mask/3D_Printed_NeoPixel_Gas_Mask.py
#	3D_Printed_NeoPixel_Ring_Hair_Dress/3D_Printed_NeoPixel_Ring_Hair_Dress.py
#	3D_Printed_Unicorn_Horn/3D_Printed_Unicorn_Horn.py
#	Adafruit_LED_Sequins/Adafruit_LED_Sequins.py
This commit is contained in:
Craig Richardson 2018-05-14 21:53:38 +01:00
commit 6d011c02b4
3 changed files with 10 additions and 8 deletions

View file

@ -55,7 +55,7 @@ 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)
@ -128,6 +128,7 @@ def fscale(originalmin, originalmax, newbegin, newend, inputvalue, curve):
rangedvalue = newbegin - (pow(normalizedcurval, curve) * newrange)
return rangedvalue
return rangedvalue
def drawLine(fromhere, to):

View file

@ -165,7 +165,7 @@ def nextspectrumcolor():
if spectrum_part == 2:
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

View file

@ -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):
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:
@ -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: