1

I am trying to make a simple chatting program with my 2 arduino uno and 2 PC. But when I tried write a message using PC1 serial monitor the message won't show up on PC2 serial monitor. I can't see the problem or maybe I miss something on the program.

Here is my code: PC1:

#include <SoftwareSerial.h>
SoftwareSerial Serial1(10,11);
void setup() 
{
 Serial.begin(9600);
 Serial1.begin(9600);
}
void loop() 
{
 if ( Serial.available()) // Check to see if at least one character is available
 {
 char ch1 = Serial.read();
 Serial1.print(ch1);
 }
 delay(200);
}

PC2:

#include <SoftwareSerial.h>
SoftwareSerial Serial1(10,11);
void setup() 
{
 Serial.begin(9600);
 Serial1.begin(9600);
}
void loop() 
{
 if (Serial1.available()) 
 {
 char ch = Serial1.read();
 Serial.print(ch); 
 }
} 
Jot
3,2761 gold badge14 silver badges21 bronze badges
asked Jan 2, 2019 at 10:44
6
  • 1
    did you cross the wires RX to TX? use write not print Commented Jan 2, 2019 at 11:11
  • Yeah I wires RX to TX. So I should use write instead print? Commented Jan 2, 2019 at 11:24
  • The delay(200) is not necessary -- why is it there? It just creates annoying delays in the output Commented Jan 2, 2019 at 17:03
  • Did you tie the grounds together? Commented Jan 2, 2019 at 21:37
  • I see maybe I can just remove the code then Commented Jan 3, 2019 at 3:13

1 Answer 1

1

I haven't tested this in a while but it has been my experience that even though you can have multiple IDE windows open, you can only have one Serial Monitor at a time. The way I got around this is to use a Terminal Emulator program for the second Arduino.

answered Jan 3, 2019 at 21:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.