I want to generate an interrupt in the following way.
I have two arduinos A and B. Suppose, pin 5 on arduino A becomes high.This must generate an interrupt for arduino B. Can I use the external interrupt by just connecting pin 5 on A to pin 2 on B and joining their grounds together? Or should I use a PCI? Actually , I am not well versed in PCI. So, if my solution is PCI, a code would be really helpful.
What is a PCI? Do you mean a PCINT? (Nobody refers to those as a PCI)
An external interrupt or pin change interrupt could be used for this; there is no particular complication.
By PCI, I mean Pin Change Interrupt. If external interrupt can work, will it work by the method I suggested? Or is there some other catch?
Nothing special, that's how you'd do it.
If there is a chance that one arduino could be powered while the other is not, put a 10k resistor between the pin5 on one and pin2 on the other; if you don't do that, if one of them sets the pin high while the other is not powered, it will be backpowered through the I/O pin through the protection diodes, the current that will flow in this case will exceed what the protection diodes can safely handle, potentially damaging the microcontroller. The resistor will limit the current to a safe level.
Thnx, I will get back if I need more help!