counting problem

You got this part wrong...

    delay(1000);   // wait a second so as not to send massive amounts of data

The comment should read "Prevent the Arduino from doing anything useful for a million microseconds."

Use millis() for timing, don't invent your own counter.