Then, take a look at the Serial examples for how to handle serial communication. You've (somewhat) described your requirements, but haven't given any indication that you've tried anything yet. To me that tells me that you just want the code, you don't want to learn to write it. If that's not the case, then you need to post the code that you have so far.