|
各位大神:
我现在有块自制的Arduino Zero,它上面有两个点动开关分别连接到了PB02(19 in Zero) 和PB03(25 in Zero)。Zero默认的只有数字引脚可以设置中断,因此我调用了pinPeripheral(19, PIO_EXTINT)来设置引脚为中断模式(从自定义SPI中学到的Orz).但是现在连接到PB02的成功了,而PB03失败了。求各位大神予以指导
- #define btn1 19
- #define btn2 25
- volatile int status=0;
- void setup(){
- pinPeripheral(19, PIO_EXTINT);
- pinPeripheral(25, PIO_EXTINT);
- attachInterrupt(19, btn1_press, FALLING);
- attachInterrupt(25, btn2_press, FALLING);
- }
- void loop(){
- while(status==1){
- dosomething();
- }
- }
- void btn1_press(){
- status=1;
- }
- void btn2_press(){
- status=0;
- }
复制代码
|
|