Welcome! Log In Create A New Profile

Advanced

Button timer

Posted by mikecard9000 
Button timer
September 23, 2021 05:42PM
Hello,
I am using an IR button as my response device. These IR buttons trigger when an object is over them, which means I need to create a slight delay to ensure the hand is not just "passing over" to reach another button. The solution I would like to use (which also follows an older task from our lab that used Presentation) is to require a 500 ms button "press" time. In looking at the documentation, I don't see a time component to the button adapter. Is there a way to do this?
best,
Mike
Re: Button timer
September 23, 2021 08:33PM
The same time components work for buttons as well.
Re: Button timer
September 24, 2021 03:39PM
I do see a time component in the V1 eyejoytrack, but V2 SingleButton does not have a HoldTime and ButtonTracker does not (at least in the documentation), 'holdtouch' like in eyejoytrack. Am I reading the V2 docs wrong? Do I need to do an AllContinue instead?
Re: Button timer
September 24, 2021 04:25PM
I don't think you read the docs carefully. v2 does not work in the same way as v1. If you need time control, add an adapter that does it to the chain.
Re: Button timer
September 25, 2021 08:40PM
Since "passing over" should not end the scene in your case, use FreeThenHold.
https://monkeylogic.nimh.nih.gov/docs_RuntimeFunctions.html#FreeThenHold
btn = SingleButton(button_);
btn.Button = 1;
fth = FreeThenHold(btn);
fth.MaxTime = 5000;
fth.HoldTime = 500;
scene = create_scene(fth);
run_scene(scene);

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.