Go Down

Topic: timeout for a function. (Read 478 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  :~

Go Up