I used Serial - TTL converter to Arduino uno pin 2 (RX) and Pin 3 (TX).
Then I use softwareserial, open Serial (uno) and mySerial (soft) began to communicate.
It is normal to send messages from Serial to mySerial.
But when I send a message from mySerial to Serial, it will automatically receive the message.
(EX:MySerial sends "a" messages, and Serial receives "a", but mySerial also receives "a", mySerial should not receive any messages)
The situation is
PC → send a → Arduino (PC and Arduino both receive a) (issue)
Arduino → Send a → PC (PC receives a, Arduino does not have any message (fine)
PC (RS232) →RS232 to TTL →Arduino.
What can I do?
system
January 25, 2017, 3:44pm
2
What can I do?
Step 1: Post your code. Obviously, it is your code that is causing the problems.
Sorry, simple code.
#include <SoftwareSerial.h>
SoftwareSerial MySerial(2, 3);
void setup() {
Serial.begin(9600); //Arduino to PC
MySerial.begin(9600); //PC to Arduino
}
void loop() {
if (MySerial.available()) {
char my = MySerial.read();
Serial.print(my); //MySerial also receives the sent value
}
if (Serial.available()) {
char real = Serial.read();
MySerial.print(real);
}
}
system
January 26, 2017, 3:38pm
4
Can you post a picture of the MySerial object that is connected to the pins? If what is connected to the pins is NOT a MySerial, why is the instance named that?
Thank PaulS !!
Sorry, I found the problem, Is a fool's mistake, jumpers T / R short circuit, resulting in data back.