diff --git a/1 - Code/hl3.py b/1 - Code/hl3.py index 75c280570b44a2734298facde9d3ee9d4415189e..e73af305c7f14ad4acb1e0c93e09d38ee074b5e3 100644 --- a/1 - Code/hl3.py +++ b/1 - Code/hl3.py @@ -107,3 +107,20 @@ class matrix: # Apply the array np.write() + + def set_led(column, line, color): + + # Check bounds + if line < 0 or line >= nb_line: + raise ValueError("Line is out of bound") + if column < 0 or column >= nb_row: + raise ValueError("Column is out of bound") + + # Convert the color + color = color_convert(color) + + # Set the specific LED to the color + np[line * nb_row + column] = color + + # Apply the array + np.write() diff --git a/1 - Code/main.py b/1 - Code/main.py index 095766a12960bf91d5df1d3bd826875a0d762bb2..0f428f244136ed377f323b3a50c12e34673a56ee 100644 --- a/1 - Code/main.py +++ b/1 - Code/main.py @@ -12,3 +12,9 @@ for i in range(8): matrix.set_column(i, color.RED) time.sleep(0.2) matrix.set_column(i, 0) + +for i in range(8): + for j in range(8): + matrix.set_led(j, i, color.RED) + time.sleep(0.1) + matrix.set_led(j, i, 0) \ No newline at end of file