From 7edee74d8077897ce620184e245b1f9252e0c21d Mon Sep 17 00:00:00 2001 From: "michael.divia" <michael.divia@etu.hesge.ch> Date: Tue, 18 Jun 2024 09:15:31 +0200 Subject: [PATCH] hl3 library created + working Matrix function --- 1 - Code/color.py | 7 ------- 1 - Code/hl3.py | 19 +++++++++++++++++++ 1 - Code/main.py | 11 +++-------- 1 - Code/matrix.py | 11 ----------- 2 - Reports/Michael_Divia.md | 5 +++++ 5 files changed, 27 insertions(+), 26 deletions(-) delete mode 100644 1 - Code/color.py create mode 100644 1 - Code/hl3.py delete mode 100644 1 - Code/matrix.py diff --git a/1 - Code/color.py b/1 - Code/color.py deleted file mode 100644 index 5c9c42c..0000000 --- a/1 - Code/color.py +++ /dev/null @@ -1,7 +0,0 @@ -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/hl3.py b/1 - Code/hl3.py new file mode 100644 index 0000000..e9ce3b4 --- /dev/null +++ b/1 - Code/hl3.py @@ -0,0 +1,19 @@ +from machine import Pin +from neopixel import NeoPixel + +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) + +def init_neopixel(): + return NeoPixel(Pin(0, Pin.OUT), 64) + +class matrix: + def clear(self, color): + np = init_neopixel() + for i in range(0,64): + np[i] = color diff --git a/1 - Code/main.py b/1 - Code/main.py index 864173b..1d2ef82 100644 --- a/1 - Code/main.py +++ b/1 - Code/main.py @@ -1,10 +1,5 @@ -from machine import Pin -from neopixel import NeoPixel -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 +from hl3 import color +from hl3 import matrix while True: - matrix.clear(color.RED) \ No newline at end of file + matrix.clear(color.RED) diff --git a/1 - Code/matrix.py b/1 - Code/matrix.py deleted file mode 100644 index 345e78e..0000000 --- a/1 - Code/matrix.py +++ /dev/null @@ -1,11 +0,0 @@ -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 diff --git a/2 - Reports/Michael_Divia.md b/2 - Reports/Michael_Divia.md index e82b304..6b83542 100644 --- a/2 - Reports/Michael_Divia.md +++ b/2 - Reports/Michael_Divia.md @@ -9,6 +9,7 @@ - [Upload du code](#upload-du-code) - [Travail](#travail) - [Lundi, 17 Juin 2024](#lundi-17-juin-2024) + - [Mardi, 18 Juin 2024](#mardi-18-juin-2024) - [Creators](#creators) - [Copyright and license](#copyright-and-license) @@ -39,6 +40,10 @@ Après avoir flasher le bon Firmware sur de Raspberry Pi, j'ai pu vérifier le b J'ai ensuite pris du temps afin de souder des pin à la matrice de LED afin de facilité ça connexion à la Breadboard. J'ai ensuite commencé à concevoir la fonction `matrix`. +## Mardi, 18 Juin 2024 + +J'ai commencé par créer `hl3.py` afin d'avoir un fichier librairie avec toutes les fonctions que nous allons implémentées. Je me suis ensuite attelé à la finalisation de la fonction `matrix`. + # Creators **Michael Divià** -- GitLab