last day (18 days later) » 

04:46
0
Q: attachInterrupt has no effect on Industruino SAMD21

Paul JurczakI'm using Industruino D21G (SAMD21G version) with Visual Studio Code extension for Arduino. attachInterrupt seems to have no effect. I tried Industruino CH1, CH6 and CH7 with the same result. When I poll these channels in a loop, I detect signal level change as expected. Here is the code: #include <

Is it possible the LED is flashing so briefly you don't notice it? Can you change your blink function to simply turn the LED off? If it goes off you know the ISR was executed.
@NickGammon Falling edge event occurs only 1-2 times per second. The test without interrupts catches it easily.
@NickGammon I also tried your idea, very good BTW. The ISR is not executed.
Still, if you change it as suggested you can be certain that the ISR was not executed. eg. digitalWrite(LED_BUILTIN, LOW);
Lol, you added your extra comment while I was typing. :)
I can't see anything wrong unless digitalPinToInterrupt does not apply to the pins you tried.
As a wild guess, try: attachInterrupt(PROXIMITY_SENSOR_NC, blink, FALLING);
@NickGammon That's what I started with, but then found that digitalPinToInterrupt() is the recommended form. I didn't work.
What you have would work on the Uno, I am not familiar with the SAMD21.
Except that the Uno only has 2 external interrupt pins (2 and 3) so it is possible that the SAMD21 does not implement external interrupts on those pins. I don't know for sure.
Try doing a serial print of the results of digitalPinToInterrupt for your pin. If it returns -1 then that pin isn't implemented.
 
1 hour later…
05:57
@PaulJurczak See above.

  last day (18 days later) »