How To Display Text Sent Via RX TX Serial Line? - Arduino Forum
Maybe your like
I'm sending data (over 9600) from one arduino to another and I can't retrieve everything that Arduino sends. However, I only send one line and I need to display it.
This will print me some numbers in a row, instead of the text and the characters I send one of them.
Can you handle functional script?
void loop() { if (Serial.available() > 0) { String readString=Serial.read(); Serial.println(readString); } } system May 24, 2019, 5:25pm 2(deleted)
UKHeliBob May 24, 2019, 5:30pm 3How about posting the ending and receiving programs in full together with a sample of what is being sent and what is being displayed ? A description of the connections between the two Arduinos, or even better, a circuit diagram, would be interesting too.
groundFungus May 24, 2019, 6:00pm 4The serial input basics tutorial may be informative.
cevepe May 24, 2019, 7:11pm 5How can I do that? I don't know much
I found this on the internet:
while (Serial.available()) { char c = Serial.read(); //gets one byte from serial buffer readString += c; //makes the String readString delay(2); //slow looping to allow buffer to fill with next character }
system May 24, 2019, 7:41pm 6spycatcher2k: So you wait for 1 byte, grab it and print it with a line feed!
Read and store until you get an end of line, THEN print.
How can I do that?
How can you do what?
If you have control over the sender, then Robin2's tutorial (see reply #3) is a great place to start.
This will print me some numbers in a row, instead of the text and the characters I send one of them.
It would be in your best interest to learn what read() returns. It would be in your best interest to learn what String does with an int, vs. what it does with a character.
1 Like Robin2 May 25, 2019, 7:07am 7Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.
The technique in the 3rd example will be the most reliable. It is what I use for Arduino to Arduino and Arduino to PC communication.
You can send data in a compatible format with code like this (or the equivalent in any other programming language)
Serial.print('<'); // start marker Serial.print(value1); Serial.print(','); // comma separator Serial.print(value2); Serial.println('>'); // end marker...R
1 Like GolamMostafa May 25, 2019, 5:52pm 8cevepe: I'm sending data (over 9600) from one arduino to another and I can't retrieve everything that Arduino sends. However, I only send one line and I need to display it.
Let us try to send this alphanumeric string: "141-142 Love Road" from Arduino UNO-1 to Arduino UNO-2 at 1-sec interval using Software UART Ports (SUART) as hardware UART Ports (UART) are permanently engaged with Serial Monitors and IDEs for 'program debugging' and 'program uploading' activities.
1. Connection diagram between UNO-1 (the sender) and UNO-2 (the receiver)
Figure-1: SUART Port based connection between two UNos
2. Upload the following sketches into UNO-1 and UNO-2. (1) Sender's Sketch
#include<SoftwareSerial.h> SoftwareSerial SUART(2, 3); //SRX = DPin-2; STX = DPin-3 char myMsg[] = "141-142 Love Road"; void setup() { Serial.begin(9600); SUART.begin(9600); } void loop() { Serial.print("Sending to UNO-2 this string: "); Serial.println(myMsg); //show on SM1 of Fig-1 what you are sending to UNO-2 //-------------------- SUART.println(myMsg); //send ASCII coded string to UNO-2 via SUART Port; goes 1 char at a time delay(1000); //1-sec test interval }(2) Receiver's Sketch
#include<SoftwareSerial.h> SoftwareSerial SUART(2, 3); //SRX = DPin-2; STX = DPin-3 void setup() { Serial.begin(9600); SUART.begin(9600); } void loop() { byte n = SUART.available(); //check if a character has arrived via SUART Port if (n != 0) //a charctaer has arrived; it has been auto saved in FIFO; say 1 as 0x31 { char x = SUART.read(); //read arrived character from FIFO (say 1) and put into x as 0x31 Serial.print(x); //send 0x31 to Serial Monitor to show 1 via UART Port } }3. Screenshots (1) Sender's 
(2) Receiver's 
BTW: 1. Try to repeat the above communication process using the following instruction at the receiver sketch:
SUART.readBytesUntil('\n', rcvMsg, 50);2. Try to repeat the above communication process by receiving the string from the InputBox of the Serial Monitor of Sender rather than having the string coded in the sketch. Do not forget to select 'Newline' option in the 'Line ending tab' of the Serial Monitor to mark the end of the string. 




Related topics
| Topic | Replies | Views | Activity |
|---|---|---|---|
| Using softwareSerial Programming | 8 | 77 | February 16, 2026 |
| Serialle Komunikation Rx/Tx Deutsch | 15 | 223 | November 6, 2025 |
| Serial communication Programming | 7 | 330 | February 9, 2025 |
| Help regarding Two Arduino Rx Tx Serial communication! Programming | 11 | 338 | February 9, 2025 |
| Communication between two arduino UNO via Tx and Rx Programming | 10 | 16012 | January 20, 2024 |
Tag » Arduino Uno Rx Tx Example
-
Adding More Serial Ports To Your Board. | Arduino Documentation
-
Serial - Arduino Reference
-
How To Set Up UART Communication On The Arduino - Circuit Basics
-
Arduino Serial Part 3: Getting Started With Serial Communication
-
Arduino Tutorial - Lesson 4 - Serial Communication And Playing With ...
-
Arduino Serial Communication Using UART - YouTube
-
Serial Communication Between Two Arduino Boards - YouTube
-
Serial Communication In Arduino - Linux Hint
-
Serial Communication In Arduino Uno - BINARYUPDATES
-
4. Serial Communications - Arduino Cookbook [Book] - O'Reilly
-
USART In Arduino Uno - ElectronicWings
-
Serial Communication - Sparkfun Learn
-
Serial/UART Communication Between Two Arduino Boards