I am trying to read data from RS232 Shield with an Arduino Mega.
This is the schematic pin, TX is 3 and RX is 2.
Wiring: PC > USB-RS232 cable > Arduino RS232 Shield. Software to send/receive data: Hercules Setup Utility
From Arduino, I can transmit data to RS232, the TX led blink and I got the value at PC. From PC, I send the data, the RX led blink but nothing is showed in Arduino Monitor.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println("Hello, world?");
}
void loop() { // run over and over
if (mySerial.available()) {
Serial.write(mySerial.read());
}
if (Serial.available()) {
mySerial.write(Serial.read());
}
}
I also tried to move RX and TX to Pin 15 and 14 but worked as the same as before.