Receiving byte in Wemos through Softwareserial

Hi, I am trying to receive data using Softwareserial from Nano to Wemos. The following code works fine
and prints values like this
0.05
0.06
0.07
except when I try to print something else after the serial.write When i code it to print something else after serial.write the received value is printed in vertical segments.

0
.
0
5
When I try to use serial.print or serial.prinln to print value on monitor it prints the ASCII characters of the received value also vertically. So a received value of 0.05 will be println as
48
46
48
53
Can anyone help serial.println the real data while other data is being printed simultaneously. My code:

#include <SoftwareSerial.h>

SoftwareSerial gtSerial(D2, D1); // Arduino RX, Arduino TX

void setup() {
Serial.begin(9600); // serial / USB port
gtSerial.begin(9600); // software serial port
}

byte rx_byte = 0; // stores received byte

void loop() {

// check if byte available on the software serial port
if (gtSerial.available()) {
// get the byte from the software serial port
rx_byte = gtSerial.read();
Serial.write(rx_byte);
// Serial.println(“1”);

}
}

If you are sending ASCII data, store the value that you read in a char, and use print() or println() to send it to the PC.

write() is for binary data.

That's the difference between Serial.write() and Serial.print(). The first will transmit the byte value as is while the second transmit the decimal string representation of the byte's value.

Sorry, let me explain again. I receive data as byte in rx_byte. On serial monitor it prints fine with Serial.write or if i convert it to char and print via Serial.print But if I try to serial-print something else like Serial.println("1") after Serial.write(rx_byte):

Serial.write(rx_byte);
Serial.println("1");

then the serial monitor shows the data as

0
.
0
5
1

how do i get the data on serial monitor as:
0.05
1
?

how do i get the data on serial monitor as:

You STOP using write() to output ASCII data.
You take your snippets to http://snippets-r-us.com. WE expect to see ALL of your code.

Serial.write(rx_byte);
Serial.println("1");

Does that really happen with the hardware serial object too? Or is it just a SoftwareSerial (for ESP8266!) "feature"? Keep in mind, ESP8266 is not an Arduino platform, many libraries are different from the Arduino libraries and may have errors in them which are not in the Arduino libraries. Which core do you use?

I am attaching the sending and receiving codes. Using the serial.println() command generates the ASCII of every data point as I explained in my last reply. My issue is the disruption of data when I try to print any other variable after printing the byte data from serial.println() or serial.write()

serialsendarduino2.ino (595 Bytes)

serialreceivewemos5.ino (511 Bytes)

My issue is the disruption of data when I try to print any other variable after printing the byte data from serial.println() or serial.write()

So, you want to send some data from one device to another. Some of it is important (to the receiver), and some is not. And, yet, you don't want to tell the receiver which data is important, and which is not. You just expect it to know. Dream on.

String rx_byte;        // stores received byte

That name is stupid, and that comment is complete nonsense.

Why are you STILL using write() to send ASCII data?

I am attaching the sending and receiving codes. Using the serial.println() command generates the ASCII of every data point as I explained in my last reply. My issue is the disruption of data when I try to print any other variable after printing the byte data from serial.println() or serial.write()

That's other code than you originally posted. Does this code show exactly the same behavior? So commenting out the Serial.println("1") shows the exact input string on the USB connection while having that line in the code puts a newline after every character?