Joystick/Gamepad button pressing

I’ve never worked with joystick code, but I suspect it is treating the buttons like a mouse does. This is different to the way that the standard PsychoPy keyboard object works. i.e. with a keyboard, we detect keys as a single event (e.g. the a key was pressed). We don’t get information about whether the key is still being held down, or when or if it was released. But when checking for mouse buttons, we get the instantaneous state of the button (i.e. is it held down at this precise moment in time).

A button press has a finite duration that is often longer than the sampling period we are using to detect it. So a single mouse press can be detected as being pressed on multiple consecutive checks. If that is the issue, then you need to alter your logic to detect the first time that the button is detected as down. You’d then set a flag like button_down = True. You don’t record anything again until button_down = False (which you set when the button is not detected as pressed.

Suggested code for handling this issue with a mouse is here: