Pages: [1]   Go Down
Author Topic: Question about the external Interrupt ??  (Read 634 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Brain Hacked
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48556
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
please I need Help on that cuz I am newbie on the arduino programing.
Then you should not be using interrupts. Poll the pin, instead.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
Brain Hacked
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25876
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why don't you tell us what you want to do, not how you think you should do it?
Try not to use the abbreviation "cuz"
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 11
Brain Hacked
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

okay... sorry smiley

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.

so any ideas ?!
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25876
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How broad is the tape, and how fast is the object moving?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 11
Brain Hacked
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the tape is about 1 cm wide, and I am not quite sure about the speed of the driving motors..
Logged

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11730
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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().
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 11
Brain Hacked
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you very much MarkT, it really helped smiley
Logged

Pages: [1]   Go Up
Jump to: