Thanks guys. Maybe software would have better; I have a couple of swords and a bunch of hardware (well, 2 chips and a mess of LEDs) that I monitoring, seemed like hardware to me:-)
Yes, both are unsigned long type. This thing could be running all day - should I do something to reset millis() so I don't run into a situation of timer1 being something like
4,294,967,290 (FF FF FF FA hex)
and timer1end rolling to
0,000,000,005 (00 00 00 05 hex)
or will that just end in 00 00 00 0B, which would be a valid & correct result, as there are no higher bits to worry about?
(hmm, 4,294,967,295 mS / 1000 = 4,294,967 seconds / 60 = 71582 minutes /60 = 1194 hrs /24 = 49 days. Guess powering down at the end of the day will be enough!)
In this case the outputs of a comparator I am looking at are sitting high, the occurrence is on the low occurring. I only want the if condition to occur when one is low (=occurred) and the other has not. The comparator is open collector, so I am using logic low as On to turn on LEDs so I can see what the arduino is seeing to make its decisions on.
(I suppose I could flip all the inputs around, and pull the anodes low to keep them turned off. I am confortable dealing with it either way).
If the event occurs, the righttouchlight will go on (pulling a cathode low) and the remaining 40mS becomes a don't care.
There is an arbitrarily selected 3 second delay after the light goes to keep it visible, so I am not concerned about breaking out of the loop.