Howdy, Stranger!

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

Supported by

Frequency assessment

Hello,
I need help to assess the frequency of a button press. In other words, how often a person pressess the same button (there will also be just one possible button to press).

Thanks for helping,
Marc

Comments

  • Hi Marc,

    How is your experiment structured? Depending on that, the implementation varies quite a bit. Here is just one example of doing it:

    cv = canvas()
    kb = keyboard()
    duration=10000 # 10 s trial
    
    cv.text('Please press the buttons as often as you want')
    counter = 0
    t0 =cv.show()
    while clock.time-t0>duration:
        kb.get_key()
        if k != None:
            counter += 1
            kb.flush()
    cv.clear()
    cv.text('You pressed the key %s times')%counter
    cv.show()
    clock.sleep(3000)
    

    Does it help?

    Eduard

    Buy Me A Coffee

  • Hi Eduard,
    when executing the script, OpenSesame directly reports that it succesfully finished the trial.

    Participants are not going to look at the monitor so it does not matter whether they can see how long and often they press the button. The button press will be assessed by a response box and the experiment takes 7 minutes.

  • My bad. Change the 'bigger than' to a 'smaller than'.

    If you have a special button box, you can't use the keyboard item. How does your responsebox communicate with Opensesame?

    Eduard

    Buy Me A Coffee

  • I changed it but still have the same problem.

    I don't know yet because the box is only available in my institution.

  • Sorry again.

    This code should work now (at least it is tested...)

    cv = canvas()
    kb = keyboard()
    duration=10000 # 10 s trial
    
    cv.text('Please press the buttons as often as you want')
    counter = 0
    t0 =cv.show()
    while clock.time()-t0<duration:
        k,t = kb.get_key()
        if k != None:
            counter += 1
            kb.flush()
    cv.clear()
    cv.text('You pressed the key %i times'%counter)
    cv.show()
    clock.sleep(3000)
    

    Buy Me A Coffee

Sign In or Register to comment.