How can I read pulses from magnetic encoder

Hello guys,
I have a motor with magnetic encoder (shown in the Pic below). When the motor (and the magnet connected to it) turn, the two-pin sensor (located next to the magnet) gives many pulses per revolution. I can have these pulses if I wire up one of the two pins of the sensor to ground.
What I need is to use those pulses to determine how many revolutions the motor should make before it stops.
I have bought many Arduino Duemilanove, mainly for this purpose, but I have been stuck.
Could anyone help me on this? Any simple code that I can use for this would be helpful.

Your help would be appreciated!
Thank you,

I have bought many Arduino Duemilanove, mainly for this purpose,

Why have you bought many, have you been blowing them up. Is there any signal conditioning on the pulses? Do you know if they are exceeding the 5V?

As to code simply use the pulses to generate an interrupt, let the interrupt service routine count them in a variable then have the main loop look at this variable and act accordingly. look in the playground or learning section for simple interrupt code.

Thank you Mike!
I have not blown up any yet :slight_smile: . I have many projects where such encoder is crucial.
The pulses do not exceed 5V although they could if required.