# A problem between stimulus onset, keyboard response and RT recording

**URL:** <https://discourse.psychopy.org/t/a-problem-between-stimulus-onset-keyboard-response-and-rt-recording/22811>\
**Category:** Coding\
**Tags:** timing\
**Created:** [May 6, 2021, 8:47am UTC](https://discourse.psychopy.org/t/a-problem-between-stimulus-onset-keyboard-response-and-rt-recording/22811 "2021-05-06T08:47:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gideon\_Isak](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/gideon_isak/32/15691_2.png) [@Gideon\_Isak](https://discourse.psychopy.org/u/Gideon_Isak)\
**Post date:** [May 6, 2021, 8:47am UTC](https://discourse.psychopy.org/t/a-problem-between-stimulus-onset-keyboard-response-and-rt-recording/22811/1 "2021-05-06T08:47:59Z")

</div>

Hey guys! I would Appreciate it if you can give me some advices to solve the problem. I’ve tried a lot but there exists problems all the time.

- Functions that I want to achieve:  
First, the stimulus will be presented for 300ms, which is a fixed duration;  
Second, the keyboard response will be considered as valid response when the RT is less than 1000ms since the stimulus presentation. Besides, the keyboard response is admitted once the stimulus is presented no matter whether it is still on the screen or not, which means that there are two possibilities: particpants press the key within the deadline of stimulus onset as well as out of the deadline.

- Problems:  
I coded in this way at first:  

If anyone have the same problem or have any solution, please do reply!!! It would help me a lot!!!

---

<div class="post-metadata">

**Author:** ![Becca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/becca/32/34260_2.png) [@Becca](https://discourse.psychopy.org/u/Becca)\
**Post date:** [May 7, 2021, 8:50am UTC](https://discourse.psychopy.org/t/a-problem-between-stimulus-onset-keyboard-response-and-rt-recording/22811/2 "2021-05-07T08:50:06Z")

</div>

Hi There,

Since this sounds like a reasonably simple trial progression, I would recommend making this in Builder view. It will be much faster to make and the timing will all be optimized, for example here you will be polling response times per frame rather than using the better timing of the keyboard class. I think you might also want to be using the autodraw functions rather than draw. If you chose to stay with coder this tutorial gives details on polling responses with the keyboard class as well as using autodraw methods which should help [Improvements — Workshops for PsychoPy 2020 2020](https://workshops.psychopy.org/3days/coding/improvements.html#presenting-stimuli-by-frames)

Hope this helps,  
Becca

---

<div class="post-metadata">

**Author:** ![Gideon\_Isak](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/gideon_isak/32/15691_2.png) [@Gideon\_Isak](https://discourse.psychopy.org/u/Gideon_Isak)\
**Post date:** [May 7, 2021, 9:23am UTC](https://discourse.psychopy.org/t/a-problem-between-stimulus-onset-keyboard-response-and-rt-recording/22811/3 "2021-05-07T09:23:27Z")

</div>

Thanks a lot for your help! Actually I found Coder easier to organize my experiment script at first. I know builder is stricter with the process of experiments. If I use builder now, there will be more things that remain to be solved (providing different feedback according to the conditions that we care, for example) I think I will think about it and give it a try. Thank you so so much!

---

<div class="post-metadata">

**Author:** ![Gideon\_Isak](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/gideon_isak/32/15691_2.png) [@Gideon\_Isak](https://discourse.psychopy.org/u/Gideon_Isak)\
**Post date:** [May 8, 2021, 2:06am UTC](https://discourse.psychopy.org/t/a-problem-between-stimulus-onset-keyboard-response-and-rt-recording/22811/4 "2021-05-08T02:06:49Z")

</div>

Thanks a lot for your help! Actually I found Coder easier to organize my experiment script at first. I know builder is stricter with the process of experiments. If I use builder now, there will be more things that remain to be solved (providing different feedback according to the conditions that we care, for example) I think I will think about it and give it a try. Thank you so so much!

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [May 8, 2021, 7:12am UTC](https://discourse.psychopy.org/t/a-problem-between-stimulus-onset-keyboard-response-and-rt-recording/22811/5 "2021-05-08T07:12:16Z")

</div>

Code components in Builder are fine and will be the direction you need to take if you decide to put your experiment online. Coder is for local experiments only.
