I am guessing from the timeout value that your trying to read an RC pulse or frame. You should not be inside an interrupt for more than a few microseconds, its really bad design to be in there for longer. Keep your ISR for fast signal measurement, and do the higher level functions like checking for timeouts, missing pulses, valid and invalid pulses in loop.
This might help - there is quite a lot of explanation in this series of posts
domingosl:
But now I need to use this inside an interrupt function, and as you know millis dont update when its outside the main loop, how can I solve this?
You should never stay in an interrupt for200ms...
Maybe you can set a flag in the interrupt and deal with it in loop().
domingosl:
But now I need to use this inside an interrupt function, and as you know millis dont update when its outside the main loop, how can I solve this?
You should never stay in an interrupt for200ms...
Maybe you can set a flag in the interrupt and deal with it in loop().
Using a flag is a nice idea, but why do you say never stay in an interrupt for200ms ? whats wrong with that?
The Arduino can only process one interrupt at a time, so everything else that uses interrupts will not work, some realworld examples -
millis and micros functions use interrupts, so will become unusable
The servo library also uses interrupts and will become unusable
Interrupts are a generally assumed to be time sensitive and everyone who writes code for others to use has this generally understanding that they will be in and out of interrupts as quickly as possible and so will the users of thier code.
If anyone starts to 'hog' interrupts, everything starts to fall apart - apart from that its easy to avoid doing so there really is no advantage or justification for long slow blocking interrupts.