Not really. Or not at all.First let's deal with "not at all"If I go back to your Original Post you said that P2 is a subset of P1. But in your diagram you seem to be treating P2 as a single pulse. A single pulse will always be a subset of a stream of pulses so the concept of subset doesn't make much sense.If you are using a single pulse in P2 as a simplification then I don't think that makes sense. What works for one pulse won't translate to matching a train of pulses.And now let's deal with "not really" - assuming that your description in the Original Post was wrong and you really only need to make decisions based on a single P2 pulse.Are you saying that there should be an output if P2 is high and P1 is low? If so that should be easy to program.And your picture in Reply #11 is very hard to read...R
This is definitely a job for a state machine, there is state and time in this decision process as the yellowpulses do not completely cover the red pulses, so combination logic cannot do the job.Use micros(), not delay or delayMicroseconds, if you want to be responsive to changing inputs at alltimes.I suspect you need at least these states:not in a pulsein a yellow pulse only (is this valid?)in a red pulse (for a short time only)in a red pulse for a long enough time without seeing the yellow pulse - output HIGHin a red + yellow pulsein a red pulse after a yellow went awayYou need to record the time when you transition from not in a pulse to in a red pulse,and then check the elapsed micros for deciding when to transition to the output HIGH state.
Yes the yellow is a subset of red. But they are out of sync in time. Thats why they dont overlap perfectly.
This complicates things.How large is the offset? Is it consistent? What is the maximum and minimum mark and space times of the pulse train?
...and mark time of pulses?
I want to have an output HIGH when the pulse is shorter, i.e. at 2,5,8.
I have two digital pulses and would like to generate an output based on some boolean logic.
Isn't #12 enough?
Would that work?
I want to have an output HIGH when the pulse is shorter, i.e. at 2,5,8. Else output LOW.