import machine
from machine import Pin
#Salidas primer bit led azul, segundo bit led rojo
ledRojo = Pin(1, Pin.OUT)
ledAzul = Pin(2,Pin.OUT)
#Entradas primer bit slider A, segundo bit slider B, tercer bit slider C
SliderA = Pin(4, Pin.IN,Pin.PULL_UP)
SliderB = Pin(5, Pin.IN,Pin.PULL_UP)
SliderC = Pin(6, Pin.IN,Pin.PULL_UP)
#Tabla de verdad de la suma de 3 numeros de 1 bit
# A | B | C | Azul | Rojo
# ---------------------------------------
# 0 | 0 | 0 | 0 | 0
# 0 | 0 | 1 | 0 | 1
# 0 | 1 | 0 | 0 | 1
# 0 | 1 | 1 | 1 | 0
# 1 | 0 | 0 | 0 | 1
# 1 | 0 | 1 | 1 | 0
# 1 | 1 | 0 | 1 | 0
# 1 | 1 | 1 | 1 | 1
while True:
A = SliderA.value()
B = SliderB.value()
C = SliderC.value()
primerBit = ( (A and (B or C)) or (B and C) )
ledAzul.value(primerBit)
segundoBit = ((not A and not B and C) or (not A and B and not C) or (A and not B and not C) or (A and B and C))
ledRojo.value(segundoBit)