Howdy, Stranger!

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

Supported by

[open] PST SR-box problem with buttonpress repeats

edited June 2013 in OpenSesame

Hi guys,

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!

Neon

Comments

  • edited 1:08PM

    Hi Neon,

    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.

    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.

    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.)

    # Warning: untested hack!
    # Keep looping until the SR Box returns nothing or a null byte.
    while True:
        c = exp.srbox._srbox.read(1)
        if c == '' or c == '\x00':
            break
    

    Cheers!
    Sebastiaan

  • edited 1:08PM

    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!

    Neale

  • edited 1:08PM

    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?

    In principle, yes. However, this particular piece of code was written so that you can insert it into an inline_script item. As you noticed yourself, a slight modification is required for this to work in the code of libeyelink itself. But it seems that you did this correctly, otherwise it would have crashed (i.e. resulted in an Exception).

    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!

    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!

    # Warning: untested hack!
    # Keep looping until the SR Box returns nothing or a null byte.
    while True:
        c = self._srbox.read(1)
        # Print character code to debug window
        print 'WAITING FOR BUTTON RELEASE: %d' % ord(c)
        if c == '' or c == '\x00':
            break
    

    Good luck!

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games