Go Down

Topic: timeout for a function. (Read 483 times) previous topic - next topic

victorjung

hi,
i am using a finger print sensor, and to see if a finger is valid it waits until a finger is on the sensor.
but  i want to do something if this function doesnt end after about 20 sec. (if nobody puts a finger)
i thought about timers, timeout, thread, and timed action but it seems that nothing can work cause the function check_a_finger() is blocking...

i wanted to do something like this:
set_a_time_out(20000);
check_a_finger();

if time out before check a finger is finish call a function.
else if check_a_finger end before, stop the timeout...

Any ideas on how to do this?
i hope you have some wonderful ideas;)
i am so desesperate that i think a bout an external i2c alarm...

Arrch

You need to rewrite the check_a_finger() function to be non-blocking or to handle the timeout itself.

tobyb121

Post the check_a_finger function (and the rest of your code) it depends what you are doing in this function

holmes4

Look at the blink without delay example and at the use of finite state machines in the playground.

Mark

victorjung

yeah i wanted to rewrite check_a_finger but it's not possible it's embed in the sensor's own micro  :~

UKHeliBob

Does the sensor have any method by which it can be reset ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

PaulS

Quote
yeah i wanted to rewrite check_a_finger but it's not possible it's embed in the sensor's own micro

You need to post your Arduino code and a link to the fingerprint reader. The check_a_finger function should not block waiting for hardware.

victorjung

hi ,
i was stupid i misunderstood the code th function was rewritable, and i include a timeout in it! it works now like i want.
Thanks all of you!

Go Up