diff --git a/code/main.py b/code/main.py index 0d51b5a..3c5df24 100644 --- a/code/main.py +++ b/code/main.py @@ -21,28 +21,44 @@ import time import machine import neopixel -NB_NEOPIXEL = 8 # Nombre de pixel +NB_PIX = 8 # Nombre de pixel +LUMINOSITE = 1.0 # Luminosité (0.0-1.0) +NEOPIX_PIN = 2 # N° de la broche de contrôle des néopixels -np = neopixel.NeoPixel(machine.Pin(2), NB_NEOPIXEL) +pixel_strip = neopixel.NeoPixel(machine.Pin(NEOPIX_PIN), NB_PIX) + +#Eteint tout à l'initialisation +for i in range(NB_PIX): + pixel_strip[i] = (0, 0, 0) +pixel_strip.write() while True: - for i in range(NB_NEOPIXEL): - np[i] = (255, 255, 255) + for i in range(NB_PIX): + print("blanc") + pixel_strip[i] = (255, 255, 255) + pixel_strip.write() time.sleep(0.5) - np.write() - for i in range(NB_NEOPIXEL): - np[i] = (0, 0, 0) + + for i in range(NB_PIX): + print("éteint") + pixel_strip[i] = (0, 0, 0) + pixel_strip.write() time.sleep(0.5) - np.write() - for i in range(NB_NEOPIXEL): - np[i] = (255, 0, 0) + + for i in range(NB_PIX): + print("rouge") + pixel_strip[i] = (255, 0, 0) + pixel_strip.write() time.sleep(0.5) - np.write() - for i in range(NB_NEOPIXEL): - np[i] = (0, 255, 0) + + for i in range(NB_PIX): + print("vert") + pixel_strip[i] = (0, 255, 0) + pixel_strip.write() time.sleep(0.5) - np.write() - for i in range(NB_NEOPIXEL): - np[i] = (0, 0, 255) + + for i in range(NB_PIX): + print("bleu") + pixel_strip[i] = (0, 0, 255) + pixel_strip.write() time.sleep(0.5) - np.write()