jonyjakee:
pleease send me a sample program which can communicate with the other microcontrollers through the strings like "john", "jak",etc with a single pin.
I don't mean to sound rude, but perhaps you should spend some time actually learning how to use Arduino. There are a variety of resources out there on how to use Arduino boards, and how to write code to get them to do what you want them to do. Google is an excellent tool to find these resources. Self help is the best help.
what about the pins i need to connect with the microcontrollers.
lets consider i am sending a stirng "jack" as
Serial.print("jack")
from the Microcontroller_A. Now which pin i have to connect from Microcontroller_A with which pin of the Microcontroller_B. And do i have to read it in microcontroller_B with
Posting straw polls of snippets of code that cannot work is simply going to get everyone else bored.
I seriously suggest you start working through the examples.
Now which pin i have to connect from Microcontroller_A with which pin of the Microcontroller_B.
TX on A to RX on B.
RX on A to TX on B.
Gnd on A to Gnd on B.
You can use Serial.available() to see how much serial data has arrived, and Serial.read() to read one of those bytes. Collect the bytes in a NULL terminated char array, and use strcmp() to compare them.
Of course, then you'll run into the issue of knowing when a packet ("jack", "john", "I found a frog", etc.) is complete. You'll need to send something that the receiver can use to determine this. It can be as simple as a carriage return/line feed (using Serial.println() instead of Serial.print()) or it can be any character that you will not use for other purposes (like '!' or '$', for example).
As others have said, this is a topic that comes up here a lot. Look at some examples.