New to Arduino and overall programming world. I am working with 3 Xbee+arduino (Node). I am trying to establish one communication like below:
- Node A will send one encrypted message to Node B.
- Node B will send another encrypted message back to Node A after processing the 1st message
- Node A will decrypt this message and encrypt some part of it and send to Node C.
- Node C will decrypt this message and encrypt some part of it and send to Node A.
Problems facing:
While Only Node A and B are connected, they are communicating fine. But when I am trying to insert C in this network things get messy. I made the program so that Node C will show a message like "No Message found" if it doesn't get any message. Now in Node A (Node A is getting messages as string value, and I am putting it together after getting a whole message], I feel it is getting both the messages haphazardly from Node B and C [The part of "No Message found"] at the same time. And for this my communication shows nothing productive.
My Questions:
- Is there anyway to distinguish for Node A to take only Node B's message at a particular time? [How can I make node A to identify or distinguish between Node B and Node C message? FYI: A is getting all encrypted message]
- How can I stop Node B after a specific time and turn the Node C on after that time? So that their message won't collide.
- I tried to change delay times but it is not working, making the whole situation more unstable.
I have been trying to get this solved for hours, not going anywhere.