Skip to content

Commit a61a4e3

Browse files
authored
按键逻辑控制点灯(外部中断)
1 parent a6024d9 commit a61a4e3

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from machine import Pin
2+
import time
3+
4+
led=Pin(0,Pin.OUT)
5+
switch=Pin(1,Pin.IN,Pin.PULL_UP)
6+
led.off()
7+
8+
9+
def on_led(switch):
10+
led.on()
11+
time.sleep(5)
12+
led.off()
13+
14+
15+
16+
switch.irq(on_led,Pin.IRQ_FALLING)
17+

0 commit comments

Comments
 (0)