Code used in WattMote, a low cost wireless pulse counter reader (eg. water meter)