More prints and .write() (for tuto)
This commit is contained in:
parent
2ff7f35c25
commit
ebc440842b
50
code/main.py
50
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()
|
||||
|
Loading…
Reference in New Issue
Block a user