Magnetic stripe biphase coding

Hello!

I have a preamplifier that amplifies the signal from a magnetic head that reads a magnetic stripe.
The preamplifier transmits the analog signal to a schmitt trigger that converts the analog signal into digital signal.
What i need is to program the arduino to measure the pulses width in order to code the signal into binary code.
Any ideas?

Thank you.

Check pulseIn() on the reference pages