Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] eye link button box (usb gamepad)

edited November 2013 in OpenSesame

Hi,

Is there a way to see in OpenSesame if a button has been pressed on eye link button box (usb game pad)? In Psychtoolbox, one could do something like:
buttonResult = Eyelink('ButtonStates');
if buttonResult ....

I couldn't find this in http://osdoc.cogsci.nl/devices/eyelink/#documentationexamplesandfunctionoverview
But I was wondering if there is an easy way to implement this?

Many thanks,

M

Comments

  • edited 10:25PM

    Hi Martijn,

    This is not part of libeyelink, but you should be able to do this through pylink, the official EyeLink Python library. The Pylink manual mentions a function called getButtonStates(), which suggests that you should be able to do something like this:

    import pylink
    buttons = pylink.getEYELINK().getButtonStates()
    

    Not tested though! But something along those lines should work.

    That being said, doesn't it make more sense to connect the gamepad to the experimental PC than the tracker? That way you can simply use the OpenSesame joystick plug-in, or the pygame.joystick module.

    Cheers!
    Sebastiaan

  • edited November 2013

    Thanks this worked. My reason is that I want the stimulus to disappear as soon as the subject responds. I also want everything in the edf file, so I only have to look at this file after the experiment (Only later did I realize that I could have recorded the response in OpenSesame, and send a message to the edf file).

    In case any else is interested. This is the inline code I used:

    import pylink
    
    start_time =self.time()
    max_response_time = 1000
    
    while (start_time+max_response_time)>self.time() :
        buttons =pylink.getEYELINK().getButtonStates()
        if buttons > 0:
            print("key press detected")
            break 
    
Sign In or Register to comment.