Hello.
I have a question about external interrupts in arduino Nano every.
The source code below is
Interrupt pin ... count5 is executed by a change in digital pin 2 (INT0).
It works fine on the arduino nano, but not on the arduino nano every.
The arduino Nano every says that external interrupts are available on all digital pins, but I am having trouble understanding the cause of this problem.
Do I need to write register port control in addition to attachInterrupt?
You are not using the digitalPinToInterrupt() syntax correctly. It is designed to take a pin number as the argument so that you don't need to know the underlying interrupt number for that particular Arduino.
For example, on the Nano Every the interrupt triggered on pin2 is not INT0
count5 is executed by a change in digital pin 2 (INT0).
Thank you for your quick reply.
I was able to run it successfully with arduino Nano every.
Also, some of your questions were incorrect.
In the case of arduino Nano
attachInterrupt((interruptPin), function, mode);
I had made it work with
When I changed to arduino Nano every, it did not work, so I rewrote it, but the syntax was wrong in that case.
I fixed the syntax and found that for arduino Nano every
attachInterrupt((interruptPin), function, mode);
does not work, and
attachInterrupt(digitalPinToInterrupt(digitalPin), function, mode);
works fine.