2

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.

2
  • Don't use D2 and D3 for the communication? There's plenty of other pins on a Nano...
    – Majenko
    Commented Sep 1, 2020 at 15:19
  • so move the SodtwareSerial to other pair of pins. 4 and 5 are good for PWM but 6 and 7 are not special.
    – Juraj
    Commented Sep 1, 2020 at 16:01

1 Answer 1

2

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-D12can be used for communication. You just have to change the parameters in the softwareserial() as below:

SoftwareSerial mySerial(4, 5); // RX, TX;;for example

enter image description here

1
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.