[open] PST SR-box problem with buttonpress repeats
I'm working on an experiment in which a PST button box is used for collecting trial responses. There are three contiguous questions which require a response from the box, before moving to the next one.
When using dummy mode (with the keyboard) it is fine, however, when using the PST box, when you press a button, it will often jump to the next question, then the next etc. instantly.
The problem seems to stem from the button-press constantly sending button-press signals whilst it is being pushed down. The first thought was to add a slight pause between the button press, and displaying the next screen/waiting for the next button press. This is not ideal though, as if the pause is too long, it can seem like pressing the button didn't do anything (and the participants press the button again). I thought to address this by clearing the screen as soon as the button was pressed (then having the small pause), but this introduces a memory artifact as the participants have to remember what was previously on the screen during the pause.
Are there separate "button-up / button-down" methods or functions? If possible I am thinking the best thing to do would be to record the time from onset of stimuli on button-down, then change stimuli/question on button-up.
I will take a look at the source code for the SR-Box plugin if I get time, but if anyone can think of a quick solution, I'd be really grateful.
I hope my explanation wasn't too confusing!
I know this problem, from back when I also used an SR Box. Basically, I added a pause long enough for participants to release the button. But this is awkward, and perhaps not always feasible.
If you would like to improve the SR Box plug-in, your submissions would be very welcome! The code is quite easy to understand, I think, and feel free to post technical questions:
At any rate, what you could try is access the serial-port object directly, and read from it until it returns a 0-byte, which corresponds to no buttons being pressed. Something like the code below should do the trick. (Disclaimer: I haven't tested this code at all, because my laptop doesn't have a serial port to test with.)
Hi Sebastian (and my other OpenSesame brethren!)
I didn't manage to sort it from your suggested hack. Probably due to my insomnia-induced incompetence, and lack of understanding. And lack of time...
I tried putting the loop you mentioned above, in the get_button_press method of the libsrbox.py file (starting on line 144). My understanding is that, whilst the the button is depressed (pushed down, not "feeling very miserable"!) the code snippet you suggested would keep looping, i.e. not continuing with the rest of the statements in the method, until the button was released. Am I off the mark with my thoughts here?
Also, I had to change exp.srbox to self (or something similar) for it to run at all.
Anyway, it just seemed to hang - I think it got stuck in that loop and didn't want to come out. I know it was entering the loop, because when I put sys.exit() (or whatever it was!) it did just that...
My python debugging skills are undeveloped so I didn't get to look further. If you have any other suggestions, you would be the main man!
Best wishes, and thanks in general for OpenSesame!
In principle, yes. However, this particular piece of code was written so that you can insert it into an
inline_scriptitem. As you noticed yourself, a slight modification is required for this to work in the code of
libeyelinkitself. But it seems that you did this correctly, otherwise it would have crashed (i.e. resulted in an
What I would do is print out each character that you read from the SR Box, and see what happens when you press or release the SR Box keys. Once you understand what is happening, you can take it from there. In general, when debugging: Print out everything!