# Exercise 12(b)
from machine import Pin, ADC
from neopixel import NeoPixel
from time import sleep
# Initialize 16-pixel ring on GPIO pin 12
ring = NeoPixel(Pin(12), 16)
pot1 = ADC(Pin(36)) # pin 36 will be used as an ADC input line
pot2 = ADC(Pin(39)) # pin 39 will be used as an ADC input line
pot3 = ADC(Pin(34)) # pin 34 will be used as an ADC input line
switch = Pin(19,Pin.IN,Pin.PULL_UP) # configure the target GPIO line as an input
while True:
pot1_value = int(pot1.read()/16)
pot2_value = int(pot2.read()/16)
pot3_value = int(pot3.read()/16)
for i in range(16):
ring[i] = (pot1_value, pot2_value, pot3_value) # Set pixel 0 to red
ring.write()
sleep(0.25)