diff --git a/1 - Code/color.py b/1 - Code/color.py new file mode 100644 index 0000000000000000000000000000000000000000..5c9c42c5571025da8ffdfd55a0ca067105f9d5dc --- /dev/null +++ b/1 - Code/color.py @@ -0,0 +1,7 @@ +class Color: + BLACK = (0, 0, 0) + BLUE = (0, 0, 255) + CYAN = (0, 255, 255) + GREEN = (0, 255, 0) + MAGENTA = (255, 0, 255) + RED = (255, 0, 0) \ No newline at end of file diff --git a/1 - Code/main.py b/1 - Code/main.py index 9a5fbc128eba8bdf207a621b5995c8c794663c32..864173b7047cb70c8ff2f4b7f4b17aa250ee2b66 100644 --- a/1 - Code/main.py +++ b/1 - Code/main.py @@ -1,17 +1,10 @@ from machine import Pin from neopixel import NeoPixel -import time +from matrix import matrix +from color import color pin = Pin(0, Pin.OUT) # set GPIO0 to output to drive NeoPixels np = NeoPixel(pin, 64) # create NeoPixel driver on GPIO0 for 64 pixels while True: - for j in range(3): - for i in range(0,64): - if j == 0: - np[i] = (255, 0, 0) - elif j == 1: - np[i] = (0, 255, 0) - elif j == 2: - np[i] = (0, 0, 255) - np.write() \ No newline at end of file + matrix.clear(color.RED) \ No newline at end of file diff --git a/1 - Code/matrix.py b/1 - Code/matrix.py new file mode 100644 index 0000000000000000000000000000000000000000..345e78e5e66ee599c96e3ef414778c64c2af9fa3 --- /dev/null +++ b/1 - Code/matrix.py @@ -0,0 +1,11 @@ +from machine import Pin +from neopixel import NeoPixel +from color import color + +pin = Pin(0, Pin.OUT) # set GPIO0 to output to drive NeoPixels +np = NeoPixel(pin, 64) # create NeoPixel driver on GPIO0 for 64 pixels + +class matrix: + def clear(self, color): + for i in range(0,64): + np[i] = color \ No newline at end of file