I am trying a two way chat between two Arduinos using serial monitor. I tried all the examples online but didn't work
Asked
Active
Viewed 250 times
-2
-
Please read [tour] _"Don't ask about... Questions you haven't tried to find an answer for (show your work!)"_ – Apr 14 '21 at 10:50
1 Answers
0
Are you using wired or wireless communication interface?
Make a circuit according to the given diagram. Connect the RX and TX pins of Arduino vice versa (the first TX pin of Arduino to the RX pin of another and the first RX pin of Arduino to the TX pin of another). Also, common the ground pin of both Arduino. Image: connection diagram
This is one way communication and for two way communication use simple data handling operation to achieve your task and i will let it to you. Just try it more and if you don't find the final solution then let me know once :)
At the sender side use this code:
char str[5] = "Arduino"; //String data
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.write(str,5); //Write the serial data
delay(1000);
}
At the receiver side use this code
char str[10]; //Initialized variable to store recieved data
void setup() {
// Begin the Serial at 9600 Baud
Serial.begin(9600);
}
void loop() {
Serial.readBytes(str,5); //Read the serial data and store in var
Serial.println(str); //Print data on Serial Monitor
delay(1000);
}

ruggeinstein
- 23
- 8
-
-
Can you please share the part of your code ? so that we can help you – ruggeinstein Apr 14 '21 at 12:24
-
try this if you want to https://howtomechatronics.com/tutorials/arduino/arduino-wireless-communication-nrf24l01-tutorial/ – ruggeinstein Apr 16 '21 at 13:42