While I don’t have an answer to why your code isn’t working, I do know that other topics about registering the duration of keypresses have come by on the forum, maybe this post could help? Logging duration of keypress to end routine - #6 by DavidBrocker
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Key Press Duration values are greater than the number of key presses/inaccurate | 3 | 651 | January 11, 2022 | |
| Measuring key lift time relative to stimulus onset | 16 | 3418 | November 26, 2022 | |
| How to transfer "keypress duration" function to online experiment? | 6 | 911 | April 8, 2021 | |
| Can't get key press duration for every key - only one value in .csv file | 1 | 737 | April 8, 2021 | |
| Key duration of overlapping key presses | 3 | 953 | April 16, 2021 |