Skip to content
Snippets Groups Projects
Commit e9938303 authored by michael.divia's avatar michael.divia
Browse files

set_line function

parent c7f1f3f6
No related branches found
No related tags found
No related merge requests found
...@@ -92,3 +92,18 @@ class matrix: ...@@ -92,3 +92,18 @@ class matrix:
# Apply the array # Apply the array
np.write() np.write()
def set_column(column, color):
# Check column
if column < 0 or column >= nb_row:
raise ValueError("Column is out of bound")
# Convert the color
color = color_convert(color)
# Set the line to the color
for i in range(column, nb_row*nb_line, nb_row):
np[i] = color
# Apply the array
np.write()
from hl3 import * from hl3 import *
import time
matrix.clear(0) matrix.clear(0)
matrix.set_line(5, color.RED)
for i in range(8):
matrix.set_line(i, color.RED)
time.sleep(0.2)
matrix.set_line(i, 0)
for i in range(8):
matrix.set_column(i, color.RED)
time.sleep(0.2)
matrix.set_column(i, 0)
...@@ -42,7 +42,7 @@ J'ai ensuite pris du temps afin de souder des pin à la matrice de LED afin de f ...@@ -42,7 +42,7 @@ J'ai ensuite pris du temps afin de souder des pin à la matrice de LED afin de f
## Mardi, 18 Juin 2024 ## 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`. J'ai aussi profité d'implémenter toute les couleurs que nous devions implémentées d'après la documentation. 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`. J'ai aussi profité d'implémenter toute les couleurs que nous devions implémentées d'après la documentation. J'ai ensuite enchaîné avec l'ajout de la fonction `set_line` et `set_column`.
# Creators # Creators
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment