The easiest thing to do is to use Serial.print() rather than Serial.write()
Sending data in human-readable form makes debugging very much easier.
Have 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.
...R