TheYour code wasis not reading the software serialSoftwareSerial. b wasb is only populated when the Pi sent data. The loop below sends what it reads from the software serialSoftwareSerial, after that is prints a new line println() (println)only because that's what your code is doing)
The listen() method of SoftwareSerial is only required if you have more than one SoftwareSerial connection.
#include <SoftwareSerial.h>
String b = "0";
SoftwareSerial portOne(2, 3); //RX= pin 2 TX= pin 3
void setup() {
Serial.begin(9600, SERIAL_8N1);
portOne.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
b = Serial.readString();
Serial.println("Data from RPI:");
}
//not required with only one software serial connection
//portOne.listen();
if (portOne.available() > 0)
{
while(portOne.available() > 0){
byte byteRead = portOne.read();
Serial.write(byteRead);
}
Serial.println();
}
}