Parsing Integers from Serial Input

for a more general tutorial read this one: Serial Input Basics

You will also need to know about the key c-string functions from stdlib.h and string.h