from machine import Pin, ADC
from utime import sleep
from neopixel import NeoPixel
import machine
from random import randrange
# za preverjanje 0.5 sekund
import time
NUM_LEDS = 50
leds = NeoPixel(Pin(13, Pin.OUT),NUM_LEDS)
potenci = machine.Pin(15, Pin.OUT)
adc = ADC(potenci)
times = 0
seznam = [[255,0,0], [0,255,0], [0,0,255]]
def convert(x, in_max,in_min, out_max, out_min = 0):
return (x - in_min) * (out_max - out_min) // (in_max - in_min) + out_min
print(seznam)
while True:
# ugasne vse ledice
leds.fill([0,0,0])
# prebere potenciometer
turned= adc.read()
# pržge ledico
leds[convert(turned, 4095, 0, NUM_LEDS -1, 0)] = [255, 0, 0]
leds.write()