detecting two rising edges from camshaft signal

For that issue I based my algorithm on timing, that's where the function millis() is for. It's correct that a double pulse is actually two pulses, but the time laps between them is shorter than the others. You can find in the code that I detect the rising edge in a precise periode of time (based on the original signal of the sensor) and a counter to count if within this particular periode of time there's two edges, if so I set a pin, otherwise it's closed.