counting and sending results

enzyb:
I wrote a code can anyone tell me what they think of it.

When you write an Arduino program the first thing you should do is test it. That way, if it does what you want you don't need to ask questions. And if it does not work as you want then telling us what it actually does is a big help in diagnosing the problem.

The Arduino system is great for learning-by-doing

...R