Well, the code looks good (possibly because I wrote it for you).
What does the output on Serial Monitor look like?