Searching for debugging steps using serial communication

I can't look closer at your code just now, but I think this forum thread will be helpful:

a7