I have done communication between ESP01 and Arduino NANO (ATMEGA328 based). ESP pins used are GPIO-0 and GPIO2. In NANO, used D2 and D3. This program working Ok. Now I want to add external interrupt in my Arduino NANO program while continuing communication with ESP01. But I cannot use D2 and D3 because it was used by communication program. Now Arduino NANO's limit is it has only two interrupt pins which are D2 and D3. So if I use this for external interrupt program, I lose communication with ESP01. Can anybody help me to use my both task at the same time: Task1- External interrupt in Arduino Nano, Task2- Communication with ESP01. Your reply will help me to solve this issue. Thanks in advance.
1 Answer
D2 and D3 Pins on Arduino nano support external Interrupt. Hence, you have to use one of those for the interrupt.
Since you are using softwareSerial()
you can easily remap it to other digital pins of the Nano.
Pins from D4-D12
can be used for communication.
You just have to change the parameters in the softwareserial()
as below:
SoftwareSerial mySerial(4, 5); // RX, TX;;for example
-
how do you know OP is using SoftwareSerial? it is not mentioned in the question. I made a wild guess in a comment– Juraj ♦Commented Sep 3, 2020 at 13:49