Working with pulsing current on Duelmilanove

Hello
I need some advice/ help.
I'm creating a automatic pet feeding bowl. Bought a comercial flip lid model and replaced the guts with a arduino duelmilanove.
I'm using a common luggage alarm to open the lid. Pet wears the coin sized active RFID tag, and the lid opens when signal is detected.
When the alarm is active it sends out a voltage pulse to a buzzer/ beeper. I've removed theese and feed the power to a dig. input on the arduino.
However, my problem is this:
I'm using the if/ else function too detect the inputs. In "non-active" state the power is only abou 2 mV (digital LOW) so that's easy to separate.

The problem comes with the active state. Since the power is pulsating it flips between "on" and "off" constantly. (Lid would just keep opening and closing)
I've tried using the pulseIn() command to "measure" the pulse and try to get some result based on the pulse length value. Hasn't worked, maybe I'm applying it wrong. I just get the ON/OFF.
I would like the arduino instead to perform one action (Keep lid open/ open lid)as long as there are pulses coming through the input.
Does anyone know how to solve this?

Code looks like this:

//Active RFID sensor test. Using green LED instead of DC motor.

int RFsensor = 11; //RF sensor conn. to dig. pin 11
int green = 3; //Green LED connected to pin 3
int RF = 0;

void setup()
{
pinMode(3, OUTPUT);
pinMode(11, INPUT);
}

void loop()
{
RF = digitalRead(11); //Read power on 11 (RF sensor)

if (RF == LOW) //If power < 2V
{
digitalWrite(3, LOW); //No light (Lid closed)
}
else
{
digitalWrite(3, HIGH); //Green light (Lid opened)
} //This setup makes the light just blink
}

What you have can be considered as "extreme bouncing" :slight_smile: Have a look at the different debouncing techniques..