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);
}
}
1 Answer 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.
write
notprint
delay(200)
is not necessary -- why is it there? It just creates annoying delays in the output