Hello there,
I was thinking... because I cant use delay into an Interrupt function why not calling a function e.g. "MyDelay" into the interrupt function !!
is that possible, and If it is, and another external interrupt happened while "MyDelay" is not yet finished, will "MyDelay" function start allover again from zero, or the interrupt will be denied !!
actually what I need to do is simply as pressing a button "as an external interrupt" that light up a LED for 30 seconds and if I repressed the button before the 30 seconds passed it repeat those 30 seconds again.
please I need Help on that cuz I am newbie on the arduino programing.
regards,
Mashad.
actually it is not that simple, cuz I am going to replace the button with a sensor so the Interrupt is caused by a sensor that has a critical function, and I will not be able to poll the pin.
this is what I exactly trying to do is to drive a robot inside a circle of a black tape when a line sensor detects the black line, then it should move backward to the center of the circle.. the program has a lot of processing from other sensors, so I cant use polling and I'm afraid I might miss the line.
You can guarantee that polling will work if you have an interrupt routine that just sets a flag - then you poll for the flag. However slow the polling it will eventually spot that something happened because the polling code is the only code that will clear the flag.
If you put delays into an interrupt routine you will hold up the entire system which will lead to all sorts of problems - keep interrupt handlers to the minimum - pass off any heavy lifting to loop().