Monitoring a cycle switch

I have a cycle switch I would like to monitor on an Arduino. I have a pump that cycles a cycle switch as it pushes oil through a pipe. If the flow stops or the switch fails, I would like to cut the pump off. Anyone have any advice? I just don't know what function I can use to create this. I may have to use an external timer, but I wanted to try to reduce parts if possible.

Thanks everyone! Kevin :)

I have a cycle switch

Perhaps a link describing this switch would be useful.

Thanks for the response, but unfortunately this is a retro fit. I don't have any real information, but I can describe the basic function. As oil flows through the switch, it pulses (opens and closes the switch, creating a high and low on the Arduino Pin). I want to run a signal through the switch. If the signal return I am monitoring stops changing states, I want to stop the pump.

The physical build of the switch includes 2 gears that the oil pushes through to change the contact state.

I just cannot see how I could make a timer in the arduino work. I am just hoping someone has a little coding advice. Any advice?

As oil flows through the switch, it pulses (opens and closes the switch, creating a high and low on the Arduino Pin).

At a safe voltage, I hope.

I want to run a signal through the switch.

It sounds like you already have a voltage running through the switch. What kind of signal are you planning to put on top of that, and how?

If the signal return I am monitoring stops changing states, I want to stop the pump.

You don't need to do anything to the voltage that is already running through the switch. Simply record when each transition from LOW to HIGH or from HIGH to LOW occurs. Then, periodically, see how long it has been since the last transition, and shut the pump down if it has been too long.

Thanks for hanging in there Paul. I agree nothing I need to do to the voltage. How do I record my transitions and the periodically check on them?

Kshoemake:
How do I record my transitions and the periodically check on them?

By reading the current state and keeping track of the last state you read. If the two are different a transition occurred. You can then use millis() to record a time stamp.