导航

    • 登录
    • 搜索
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. 主页
    2. gcaf
    G
    • 举报资料
    • 资料
    • 关注
    • 粉丝
    • 屏蔽
    • 帖子
    • 楼层
    • 最佳
    • 群组

    gcaf

    @gcaf

    0
    声望
    1
    楼层
    348
    资料浏览
    0
    粉丝
    0
    关注
    注册时间 最后登录

    gcaf 关注

    gcaf 发布的帖子

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