From 4ca72a8231a082ba1dc0eda5df36e7b1bc84fddc Mon Sep 17 00:00:00 2001 From: Mike Barela Date: Tue, 20 Nov 2018 16:16:19 -0500 Subject: [PATCH] Update code.py linting whitespace --- NeoTrellis_Paint/code.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/NeoTrellis_Paint/code.py b/NeoTrellis_Paint/code.py index 5c70cdc7..21ad785c 100644 --- a/NeoTrellis_Paint/code.py +++ b/NeoTrellis_Paint/code.py @@ -1,11 +1,11 @@ -# Simple paint program for Trellis M4 Express +# Simple paint program for Trellis M4 Express # Press any button it will cycle through a palette of colors! # # Mike Barela for Adafruit Industries November, 2018 # import time import adafruit_trellism4 - + trellis = adafruit_trellism4.TrellisM4Express() # See https://www.w3schools.com/colors/colors_picker.asp @@ -26,27 +26,27 @@ BLACK = 0x000000 color_cycle = [BLACK, RED, ORANGE, YELLOW, OLIVE, GREEN, AQUA, TEAL, BLUE, NAVY, MAROON, PURPLE, PINK, WHITE] - + colors = 13 # Number of colors in color_cycle - + key_state = [0 for _ in range(32)] # All keys are color 0 (BLACK) trellis.pixels.fill(BLACK) # Turn off all pixels - + current_press = set() while True: pressed = set(trellis.pressed_keys) for press in pressed - current_press: if press: print("Pressed:", press) - x, y = press + x, y = press pixel = (press[1] * 8) + press[0] if key_state[pixel] == colors: # If we're at white key_state[pixel] = 0 # Set back to black else: key_state[pixel] += 1 # Use next color - # Change the pushed pixel to the next color + # Change the pushed pixel to the next color trellis.pixels[x, y] = color_cycle[key_state[pixel]] - + time.sleep(0.08) current_press = pressed