Hi all,
I'm rather new to the Arduino scene so any help is very welcomed.
I have a home made Arduino Zero.The board have two buttons which connect to PB02(19 in Zero) and PB03(25 in Zero).I want to set interrupt on these buttons.
The button connected to PB02 successd,but the other failed.
In SAMD21G datasheet,I find PB02 belongs to EXTINT[2],and PB02 belongs to EXTINT[3],so they don't conflict.
The code following
#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;
}