import machine
from machine import Pin
S2=Pin(1, Pin.OUT)
S1=Pin(2, Pin.OUT)
S0=Pin(3, Pin.OUT)
E1=Pin(4, Pin.IN, Pin.PULL_UP)
E2=Pin(5, Pin.IN, Pin.PULL_UP)
E3=Pin(6, Pin.IN, Pin.PULL_UP)
E4=Pin(7, Pin.IN, Pin.PULL_UP)
while True:
A=E1.value()
B=E2.value()
C=E3.value()
D=E4.value()
suma2=((A and B and D) or (B and C and D) or (A and C))
suma1=((A and not C and not D) or (A and not B and not C) or (not A and not B and C) or (not A and C and not D) or (not A and B and not C and D) or (A and B and C and D))
suma0=((not B and D) or (B and not D))
S2.value(suma2)
S1.value(suma1)
S0.value(suma0)S2
S1
S0
A
B
C
D