from machine import Pin
import time
led = Pin(4, Pin.OUT) #Il pin 4 lo imposto come output
led.off() #All'inizio il led è spento
btn1 = Pin(14, Pin.IN, Pin.PULL_UP)
btn2 = Pin(27, Pin.IN, Pin.PULL_UP)
def accendiLed(bt1):
led.on()
def spegniLed(bt2):
led.off()
btn1.irq(handler=accendiLed, trigger=Pin.IRQ_FALLING)
btn2.irq(handler=spegniLed, trigger=Pin.IRQ_FALLING)
#while True:
#led.value(not led.value()) #Quando entro nel ciclo spegno e accendo il led ciclicamente a seconda del valore del led
#time.sleep(1)
#if btn1.value() == 0: #Se il bottone 1 è premuto (livello logico alto)
# led.on()
#if btn2.value() == 0:
# led.off()
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
led1:A
led1:C
r1:1
r1:2
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
btn2:1.l
btn2:2.l
btn2:1.r
btn2:2.r