from machine import Pin
import time
import neopixel
# Configuration des NeoPixels
nbre_led = 16 # Nombre de led par Neopixel ring
npix_pin_1 = Pin(12, Pin.OUT)
npix_pin_2 = Pin(13, Pin.OUT)
npix_pin_3 = Pin(14, Pin.OUT)
npix_pin_4 = Pin(15, Pin.OUT)
neopix_1 = neopixel.NeoPixel(npix_pin_1, nbre_led)
neopix_2 = neopixel.NeoPixel(npix_pin_2, nbre_led)
neopix_3 = neopixel.NeoPixel(npix_pin_3, nbre_led)
neopix_4 = neopixel.NeoPixel(npix_pin_4, nbre_led)
col_altitude = 10
pixl_1 = 0
pixl_2 = 0
pixl_3 = 0
pixl_4 = 0
def pivot_horaire(helice, pixl):
for i in range(nbre_led):
helice[i] = (255, 255, 255)
if i == pixl:
helice[i] = (50, 255, 50)
helice.write()
pixl = (pixl + 1) % 16
return pixl
def pivot_non_horaire(helice, pixl):
for i in range(nbre_led):
helice[i] = (255, 255, 255)
if i == pixl:
helice[i] = (50, 255, 50)
helice.write()
pixl = (pixl - 1) % 16
return pixl
#
while True:
pixl_1=pivot_horaire(neopix_1, pixl_1)
pixl_2=pivot_non_horaire(neopix_2, pixl_2)
pixl_3=pivot_non_horaire(neopix_3, pixl_3)
pixl_4=pivot_horaire(neopix_4, pixl_4)
col_altitude = (col_altitude + 10) % 256
time.sleep(0.09)