need to communicate with two micro controller with strings

hi, i want to connect two micro controllers and make them to communicate with the single pin connected to it.

i like send the signal with strings like "john", "jack", etc. and not with the usual 0 and 1.

i am new with the micro controller concept. please help me.

Provided the pins you use are serial pins (either hardware or software serial), then you can do that.

pleease send me a sample program which can communicate with the other microcontrollers through the strings like "john", "jak",etc with a single pin.

pleease send me a sample program which can communicate with the other microcontrollers through the strings like "john", "jak",etc with a single pin.

"Communication" implies a two way exchange of information. That requires two pins, or the knowledge of when to change the mode from input to output.

If you are using Serial to send data, it is just like sending data to the Serial Monitor or other PC application.

Serial.print("Jack");

will it work with the serial pins 0,1.

if so will the programm will be like this

digitalWrite(0,"jack");
digitalWrite(1,"john");

will it be write.

will it work with the serial pins 0,1.

Yes.

if so will the programm will be like this

No.

The Serial object communicates with the hardware serial pins.

Serial.print("jack");
Serial.print("john");

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

if(Serial.read("jack"))

to perform an action.

if(Serial.read("jack"))
to perform an action.

No, it doesn't work like that.
I also suggest you work through some examples.

Self help is the best help.

i too accept. but time factor is more needed. learning by self takes more time than to learning from others.

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.

jonyjakee:

Self help is the best help.

i too accept. but time factor is more needed. learning by self takes more time than to learning from others.

You started this thread nearly 2 hours ago. In that time, you could have gone through at least several tutorials, if not half a dozen or more.