Reading and counting pulses with Arduino - Internet of Things