Reading a Flash Code with Spark?

Happy Almost New Year Gang.

I am new to spark but loving it having already completed one project using it ( A thermostat ). I am now wondering if SPARK is capable of reading a flash code.

I currently have a pin set to go high on a contact closure but I want to get more specific details by reading a flash code on that pin of 100ms on, 200ms off with a 5 second interval between flashes.

Doing so I can ‘decode’ a signal from the hardware I am interfacing with. So for example 4 flashes of 100ms on 200ms off with 5 second pause = ‘machine melted down’, 3 flashes of 100ms on 200ms off with 5 second pause = ‘overheat’, etc.

Doable? Any advice / help appreciated.

ARDUINO it seems has a function for it ( which may also better explain what I am trying to do );
http://arduino.cc/en/Reference/pulseIn

Looking forward to any suggestions. I noticed @timb was working on a method, perhaps your brain can help me?