Edge detection - pulse

Hello guys, I need help with a code.

I am automating an alarm center and I would like to program the arduino to send me a message every time:
1- The alarm is activated (on)
2 - The alarm has been deactivated (off)
3 - The alarm goes off

When the alarm is activated (on), it triggers a pulse. When it is deactivated, it triggers two pulses. And when it goes off, the pulse is continuous.

I need help to write a code that read the rising edge, and if it detects a pulse within 3 seconds, it would do an X command, if it detects two pulses, Y command, and if the pulse is active for more than 3 seconds, it would execute Y command.

Can you help me?

Thank you!

Start by looking at the StateChangeDetection example in the IDE

it would be helpfull to know what you have so far and what your circuit looks like. are you doing the entire system with arduino? what pins are you hooked to?

this sounds like very simple programming. if you are new to programming, i'm sure a quick google would bring you to a tutorial to get you started.