import sensor, image, pyb, micropython, utime
micropython.alloc_emergency_exception_buf(100)
from pyb import Pin
global bull
bull=1
def callback(line):
global bull
bull=bull+1
extint.disable()
extint = pyb.ExtInt(Pin('P7'), pyb.ExtInt.IRQ_RISING, pyb.Pin.PULL_UP, callback)
while(bull==1):
utime.sleep(1)
print(bull)
utime.sleep(1)
if bull==2:
utime.sleep(1)
print(bull)
extint.enable()
utime.sleep(1)
if bull==3:
utime.sleep(1)
print(bull)
extint.enable()
utime.sleep(1)
if(True):
print('Hello,World')
utime.sleep_ms(500)
print(bull)
G
gcaf
@gcaf
0
声望
1
楼层
300
资料浏览
0
粉丝
0
关注
gcaf 发布的帖子
-
请问外部中断的函数具体是如何实现的啊,要实现的就是通过外部中断改变全局变量的值,返回给主程序中,让其执行不同的内容?