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 发布的帖子
-
请问外部中断的函数具体是如何实现的啊,要实现的就是通过外部中断改变全局变量的值,返回给主程序中,让其执行不同的内容?