# PWM en RGB

from machine import Pin, PWM, ADC
from utime import sleep, sleep_ms

#Crear objetos

l_red = PWM (Pin(15), freq = 5000)
l_green = PWM (Pin(2), freq = 5000)
l_blue = PWM (Pin(4), freq = 5000)

pl_red = ADC(Pin(32))
pl_red.width(ADC.WIDTH_10BIT)

pl_green = ADC(Pin(35))
pl_green.width(ADC.WIDTH_10BIT)

pl_blue = ADC(Pin(34))
pl_blue.width(ADC.WIDTH_10BIT)

while True:

    led_r = pl_red.read()
    led_g = pl_green.read()
    led_b = pl_blue.read()

    l_red.duty(led_r)
    l_green.duty(led_g)
    l_blue.duty(led_b)

    print(led_r//4,led_g//4,led_b//4)

    sleep_ms(50)