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); 
    }
} 
6
  • 1
    did you cross the wires RX to TX? use write not print
    – Juraj
    Jan 2, 2019 at 11:11
  • Yeah I wires RX to TX. So I should use write instead print?
    – Ilzu
    Jan 2, 2019 at 11:24
  • The delay(200) is not necessary -- why is it there? It just creates annoying delays in the output Jan 2, 2019 at 17:03
  • Did you tie the grounds together?
    – R Zach
    Jan 2, 2019 at 21:37
  • I see maybe I can just remove the code then
    – Ilzu
    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.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.