极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 20831|回复: 0

Arduino Zero 在数字引脚之外的引脚上设置中断失败

[复制链接]
发表于 2019-6-7 12:25:56 | 显示全部楼层 |阅读模式
各位大神:
  
  我现在有块自制的Arduino Zero,它上面有两个点动开关分别连接到了PB02(19 in Zero) 和PB03(25 in Zero)。Zero默认的只有数字引脚可以设置中断,因此我调用了pinPeripheral(19, PIO_EXTINT)来设置引脚为中断模式(从自定义SPI中学到的Orz).但是现在连接到PB02的成功了,而PB03失败了。求各位大神予以指导



  1. #define btn1 19
  2. #define btn2 25

  3. volatile int status=0;

  4. void setup(){
  5.   pinPeripheral(19, PIO_EXTINT);
  6.   pinPeripheral(25, PIO_EXTINT);
  7.   attachInterrupt(19, btn1_press, FALLING);
  8.   attachInterrupt(25, btn2_press, FALLING);
  9. }

  10. void loop(){
  11.   while(status==1){
  12.     dosomething();
  13.   }
  14. }

  15. void btn1_press(){
  16.   status=1;
  17. }

  18. void btn2_press(){
  19.   status=0;
  20. }
复制代码

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 需要先绑定手机号

Archiver|联系我们|极客工坊

GMT+8, 2024-4-25 12:43 , Processed in 0.040238 second(s), 18 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表