Here is everything you need to know: Serial Input Basics - updated - Introductory Tutorials - Arduino Forum