from machine import Pin, ADC, PWM
from neopixel import NeoPixel
import utime
potentiometre = ADC(0)
pixels = NeoPixel(Pin(16), 5) 
while True:
    valeur = potentiometre.read_u16()
    print("Consommation d'eau: ")
    consommation = int(valeur / 1000)
    print(consommation, "Litres")
    if consommation > 40:           #rouge clignotant
        pixels[0] = (255, 0, 0) 
        pixels.write()  
        utime.sleep(0.2)
        pixels[0] = (0, 0, 0) 
        pixels.write() 
        utime.sleep(0.2)
    elif consommation > 30:         #rouge
        pixels[0] = (255, 0, 0) 
        pixels.write()  
        utime.sleep(0.2)
    elif consommation > 20:         #rose
        pixels[0] = (150, 30, 140) 
        pixels.write()  
        utime.sleep(0.2)
    elif consommation > 10:         #bleu
        pixels[0] = (50, 180, 230) 
        pixels.write()  
        utime.sleep(0.2)
    else:                           #vert
        pixels[0] = (0, 255, 0) 
        pixels.write()  
        utime.sleep(0.2)    
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT