from machine import Pin, PWM, ADC
import time
from lcd import LCD
#Configuracion pines físicos
servo_azul = PWM(Pin(0))
servo_azul.freq(50)
servo_rojo = PWM(Pin(1))
servo_rojo.freq(50)
servo_amarillo = PWM(Pin(2))
servo_amarillo.freq(50)
pote = ADC(Pin(26))
lcd = LCD()
#Mapeo Ángulo Servo
def mapeo_servo_azul(angulo_azul):
# Asegurar que el ángulo esté dentro del rango 0-180
if angulo_azul < 0: angulo_azul = 0
if angulo_azul > 180: angulo_azul = 180
# Mapeo lineal de 0, 180 a 1638, 8192 para el servo
duty_servo_azul = int(1638 + (angulo_azul * 34.6))
servo_azul.duty_u16(duty_servo_azul)
#Usuario ingresa cantidad de pigmento
#Usuario ingresa peso del producto
#Movimiento servos proporcional al valor ingresado de cada pigmento}
#Lectura ADC correspondiente al peso ingresado (5 kg = 2,5 V o 49647)
#Mostrar peso en pantalla LCD
while True:
txt = input("Valor: ")
n = int(txt)
#pig_azul = int(txt) # "7" -> 7
# angulo_azul = int((pig_azul / 10) * 180)
#mapeo_servo_azul(angulo_azul)Loading
pi-pico-w
pi-pico-w