question 1
from machine import Pin
from time import sleep
switch1 = Pin(2, Pin.IN)
switch2 = Pin(3, Pin.IN)
led1 = Pin(14, Pin.OUT)
led2 = Pin(21, Pin.OUT)
while True :
sw1_state = switch1.value()
sw2_state = switch2.value()
print("switch 1:",sw1_state)
print("switch 2:",sw2_state)
if sw1_state == 1 and sw2_state==1:
led1.value(0)
led2.value(0)
if sw1_state == 0 and sw2_state==0:
led1.value(0)
led1.value(0)
if sw1_state ==1 and sw2_state ==0:
led1.value(1)
led2.value(0)
if sw1_state ==0 and sw2_state ==1:
led1.value(0)
led2.value(1)
sleep(0.1)