La pulseIn può andar bene, misura la durata di un impulso su un certo pin. http://arduino.cc/en/Reference/PulseIn