communicating with a raspberry pi !

Deal all,
I am using arduino and raspberry pi to send information to each other via serial port. I have been successfully able to send information to the raspberry pi and even receive on the arduino.

But I got stuck when I needed to check and compare the values, since the raspberry pi sends the data once, I am trying to create a while loop which looks something like this:
while(Serial.available() < 0) { do nothing} // which keeps it busy until the raspberry pi finishes sending the information.

Then when I read the data it gets lost somehow.

Is there an alternative way to read the serial data and work with it.

You need a more robust system for receving your data. Look at the examples in serial input basics.

If you are using Python on the RPi you may also be interested in this Python-Arduino demo

...R