From c00960a6b743f21a4b5f3a1db5f4b69d87ba5a0c Mon Sep 17 00:00:00 2001 From: "michael.divia" <michael.divia@etu.hesge.ch> Date: Tue, 18 Jun 2024 09:22:38 +0200 Subject: [PATCH] Global variables for GPIO & Nb of LED --- 1 - Code/hl3.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/1 - Code/hl3.py b/1 - Code/hl3.py index 90aeee4..04d489b 100644 --- a/1 - Code/hl3.py +++ b/1 - Code/hl3.py @@ -1,6 +1,9 @@ from machine import Pin from neopixel import NeoPixel +np_led = 64 +gpio_neopixel = 0 + class color: BLACK = (0, 0, 0) BLUE = (0, 0, 255) @@ -10,11 +13,11 @@ class color: RED = (255, 0, 0) def init_neopixel(): - return NeoPixel(Pin(0, Pin.OUT), 64) + return NeoPixel(Pin(gpio_neopixel, Pin.OUT), np_led) class matrix: def clear(color): np = init_neopixel() - for i in range(64): + for i in range(np_led): np[i] = color np.write() \ No newline at end of file -- GitLab