Ending routine with joystick input

Hello!

I am building an experiment that calculates reaction times of different sorts of images. I need a joystick to determine when each routine ends, with a 50% threshold in either y-axis direction (toward or away from participant). I have included below a snapshot of the custom code I wrote and included in every trial:

In the Joystick component settings, I have set end routine on: “valid click”, and left Allowed Buttons $ blank in the Advanced tab.

Unfortunately this does not accomplish anything. Any thoughts or suggestions? Thank you!

Hello,

This code is in the “begin routine” tab. Hence it will run just once, before the routine even starts, and so can’t do very much.

Shift it to the “Each frame” routine, so that it will be called repeatedly, on every screen refresh during the trial.

Hi Michael,

Thank you for your reply. While I am able to print the axis values, I am still not able to end the routine when the y-axis value crosses the threshold. A snapshot of my relevant code is below:

Here is the relevant code that runs at the beginning of the experiment, when the routine is initialized:

Any ideas why this may be the case? Thank you very much!