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 machine
|
||||||
import neopixel
|
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:
|
while True:
|
||||||
for i in range(NB_NEOPIXEL):
|
for i in range(NB_PIX):
|
||||||
np[i] = (255, 255, 255)
|
print("blanc")
|
||||||
|
pixel_strip[i] = (255, 255, 255)
|
||||||
|
pixel_strip.write()
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
np.write()
|
|
||||||
for i in range(NB_NEOPIXEL):
|
for i in range(NB_PIX):
|
||||||
np[i] = (0, 0, 0)
|
print("éteint")
|
||||||
|
pixel_strip[i] = (0, 0, 0)
|
||||||
|
pixel_strip.write()
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
np.write()
|
|
||||||
for i in range(NB_NEOPIXEL):
|
for i in range(NB_PIX):
|
||||||
np[i] = (255, 0, 0)
|
print("rouge")
|
||||||
|
pixel_strip[i] = (255, 0, 0)
|
||||||
|
pixel_strip.write()
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
np.write()
|
|
||||||
for i in range(NB_NEOPIXEL):
|
for i in range(NB_PIX):
|
||||||
np[i] = (0, 255, 0)
|
print("vert")
|
||||||
|
pixel_strip[i] = (0, 255, 0)
|
||||||
|
pixel_strip.write()
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
np.write()
|
|
||||||
for i in range(NB_NEOPIXEL):
|
for i in range(NB_PIX):
|
||||||
np[i] = (0, 0, 255)
|
print("bleu")
|
||||||
|
pixel_strip[i] = (0, 0, 255)
|
||||||
|
pixel_strip.write()
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
np.write()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user