Update code.py
Look to correct Travis nitpicks,
This commit is contained in:
parent
874ce794ad
commit
d298b88154
1 changed files with 13 additions and 13 deletions
|
|
@ -17,7 +17,7 @@ blue_led = pulseio.PWMOut(board.D11, frequency=5000, duty_cycle=65535)
|
|||
|
||||
switch = DigitalInOut(board.D12)
|
||||
switch.direction = Direction.INPUT
|
||||
switch.pull = Pull.UP
|
||||
switch.pull = Pull.UP
|
||||
|
||||
colorways = [fancy.CRGB(1.0, 1.0, 1.0), # White
|
||||
fancy.CRGB(1.0, 0.0, 0.0), # Red
|
||||
|
|
@ -26,11 +26,11 @@ colorways = [fancy.CRGB(1.0, 1.0, 1.0), # White
|
|||
fancy.CRGB(0.0, 0.5, 0.5), # Cyan
|
||||
fancy.CRGB(0.0, 0.0, 1.0), # Blue
|
||||
fancy.CRGB(0.5, 0.0, 0.5), # Magenta
|
||||
# you can also make lists of colors to cycle through, like red/green/blue:
|
||||
[fancy.CRGB(1.0, 0.0, 0.0), fancy.CRGB(0.0, 1.0, 0.0), fancy.CRGB(0.0, 0.0, 1.0)],
|
||||
# or just white/blue
|
||||
[fancy.CRGB(1.0, 1.0, 1.0), fancy.CRGB(0.0, 0.0, 1.0)],
|
||||
]
|
||||
# you can also make lists of colors to cycle through, like red/green/blue:
|
||||
[fancy.CRGB(1.0, 0.0, 0.0), fancy.CRGB(0.0, 1.0, 0.0), fancy.CRGB(0.0, 0.0, 1.0)],
|
||||
# or just white/blue
|
||||
[fancy.CRGB(1.0, 1.0, 1.0), fancy.CRGB(0.0, 0.0, 1.0)],
|
||||
]
|
||||
color_index = 0
|
||||
|
||||
def set_rgb_led(color):
|
||||
|
|
@ -46,7 +46,7 @@ while True:
|
|||
pixels.fill(colorway.pack())
|
||||
pixels.show()
|
||||
set_rgb_led(pixels[0]) # set RGB LED as same as first pixel
|
||||
|
||||
|
||||
else:
|
||||
# its a list of colors to cycle through
|
||||
print("Setting pixels to a pallete of", colorway)
|
||||
|
|
@ -57,11 +57,11 @@ while True:
|
|||
# number and the swirl number to take us through the whole thing!
|
||||
pallete_index = ((swirl+i) % NEOPIXEL_NUM) / NEOPIXEL_NUM
|
||||
# Then look up the color in the pallete
|
||||
color = fancy.palette_lookup(colorway, pallete_index)
|
||||
color_lookup = fancy.palette_lookup(colorway, pallete_index)
|
||||
# display it!
|
||||
pixels[i] = color.pack()
|
||||
pixels[i] = color_lookup.pack()
|
||||
# check button often
|
||||
if not switch.value:
|
||||
if not switch.value:
|
||||
break # if its pressed, quit now
|
||||
pixels.show() # show the pixels!
|
||||
set_rgb_led(pixels[0]) # set RGB LED as same as first pixel
|
||||
|
|
@ -69,11 +69,11 @@ while True:
|
|||
print('Done with pallete display')
|
||||
|
||||
while switch.value:
|
||||
pass # hang out and wait for the button to be pressed
|
||||
pass # hang out and wait for the button to be pressed
|
||||
while not switch.value:
|
||||
pass # hang out and wait for the button to be released!
|
||||
pass # hang out and wait for the button to be released!
|
||||
print("Button pressed")
|
||||
# go to the next colorway
|
||||
color_index = (color_index + 1) % len(colorways)
|
||||
# a little debouncin' delay
|
||||
time.sleep(0.01)
|
||||
time.sleep(0.01)
|
||||
|
|
|
|||
Loading…
Reference in a new issue