Send string to and from raspberry pi

no,
data is passed to processMsg() as an argument. i created processMsg() instead of packing all that code inside the if (Serial.available()) condition and so that it only executes when data is received.

in the original code, that code is invoked regardless of whether a String is received using the existing value of data