I'm trying using Serial 1/2/3 of an arduino Mega . I followed the first example of the thread "Serial input Basics ".
This works fine with serial (so connected via USb Arduino native driver ) but I'm unable to make it working (I don't receive caracters ) with the the others serial (1/2/3) and i don't understand why. Can the converter usb/RS232 be faultive ? I used this one : https://www.ugreen.com/product/UGREEN_USB_to_RS232_DB9_Serial_Cable_Male_A_Converter_Adapter-en.html .
Is it some recommanded USB hardware / drivers to use without problems the serials 1/2/3
Sorry, my crystal ball is broken. Please post your code AND a schematic. Please don't post a Fritzing breadboard mess, a simple hand drawing will do. See How to use the forum for more info.
the code I use is the code of the first example of thread "Serial Input Basics - updated"
// Example 1 - Receiving single characters
char receivedChar;
boolean newData = false;
void setup() {
Serial.begin(9600);
Serial.println("<Arduino is ready>");
}
void loop() {
recvOneChar();
showNewData();
}
void recvOneChar() {
if (Serial.available() > 0) {
receivedChar = Serial.read();
newData = true;
}
}
void showNewData() {
if (newData == true) {
Serial.print("This just in ... ");
Serial.println(receivedChar);
newData = false;
}
}
I just changed "serial" for "serial1" ( or 2/3) . on the other side , I use an PC with just a Serial port monitor (Eltima Software).
With the converter Ugreen ,I use a passive interface (passive connection rs232 )
So I have juste three wires 2/3 /5 directly on the TX1/RX1/ GND (VS tx2/rx2/GND or rx3/rx3/gnd) of the Mega
You should get a USB to TTL serial adapter. They are available from all the usual sources (eBay, Aliexpress, Amazon, SparkFun, Adafruit, etc.) for a low price and are a very useful tool to have on hand. The most common are the ones based on the FT232 or the CH340. Either will work fine.