Skip to content

Commit

Permalink
按键逻辑控制点灯(外部中断)
Browse files Browse the repository at this point in the history
  • Loading branch information
yangkun5330 authored Nov 5, 2022
1 parent a6024d9 commit a61a4e3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions 按键逻辑控制点灯(外部中断).py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from machine import Pin
import time

led=Pin(0,Pin.OUT)
switch=Pin(1,Pin.IN,Pin.PULL_UP)
led.off()


def on_led(switch):
led.on()
time.sleep(5)
led.off()



switch.irq(on_led,Pin.IRQ_FALLING)

0 comments on commit a61a4e3

Please sign in to comment.