from machine import Pin
import time
led = Pin(2,Pin.OUT) # create output pin on GPIO2
buttn = Pin(13,Pin.IN) # create input pin on GPIO13
# Define an interrupt handling function: led on for 1 second when button is pressed
def showPush(pin):
led.on()
time.sleep(1)
led.off()
# Attach an interrupt to that pin by calling the irq() method
buttn.irq(trigger=Pin.IRQ_RISING, handler=showPush)
Loading
esp32-devkit-v1
esp32-devkit-v1