from machine import Pin,ADC
from time import sleep
import neopixel
import random
pot1= ADC(Pin(26))
pot2= ADC(Pin(33))
pot3= ADC(Pin(27))
btn = Pin(18,Pin.IN, Pin.PULL_UP)
NUM_LED = 16
leds = neopixel.NeoPixel(Pin(4), NUM_LED)
while True:
btnVal = not bool(btn.value())
if btnVal == False:
barva= [random.randrange(0,255),random.randrange(0,255),random.randrange(0,255)]
for i in range(NUM_LED):
leds[i-1]=[0,0,0]
leds[i]=barva
sleep(max(pot1.read()/10000,0.1))
leds.write()
else:
for i in range(NUM_LED):
leds[i]=[0,0,0]
leds.write()