from machine import Pin,ADC
from utime import sleep 
import neopixel 
import random
import time

NUM_LEDS = 16

leds = neopixel. NeoPixel (Pin(15), NUM_LEDS)
pot=Pin(4,Pin.IN)
potval=ADC(pot)

r=random.randrange(0,256)
g=random.randrange(0,256)
b=random.randrange(0,256)

while True:
    for x in range(NUM_LEDS):
        leds[x]=[r,g,b]
        leds.write()
        moc=potval.read()

        moc=max(1,moc)

        r=(r+random.randrange(0,moc)) % 255
        g=(g+random.randrange(0,moc)) % 255
        b=(b+random.randrange(0,moc)) % 255

        sleep(0.3)