from machine import Pin,ADC
import time
horz = ADC(Pin(27))
vert = ADC(Pin(28))
rLed = Pin(18,Pin.OUT)
gLed = Pin(17,Pin.OUT)
bLed = Pin(16,Pin.OUT)
while True:
time.sleep(0.2)
if vert.read_u16() > 50000:
rLed.value(1)
gLed.value(0)
bLed.value(0)
elif vert.read_u16() < 10000:
rLed.value(1)
gLed.value(0)
bLed.value(1)
elif horz.read_u16() > 50000:
rLed.value(1)
gLed.value(1)
bLed.value(0)
elif horz.read_u16() < 10000:
rLed.value(0)
gLed.value(1)
bLed.value(1)
else:
rLed.value(0)
gLed.value(0)
bLed.value(0)