Help with digit span Please

Hello everyone, any help with coding is highly appreciated.

I have already the digit span designed. However, it has a bug. The participant hears a sequence of digits and is asked to recall them immediately following he/she finishes hearing the digits in the identical forward sequence. The participant is supposed to be unable to type the digits while he/she is hearing the digits. However, what happens is that (the bug) the participant can type the digits while he/she is hearing. This, as a result, negatively affects the results.
digit span

What you need to do is clear the keyboard buffer before you start to collect the response.


See also

Thank you Wakecarter so much for your help.

I am not well familiar with the coding. I pasted your code into my script. Could you please have a quick look at the photo if I put the code in the correct place?
Digit span 2

You seem to placed the code in between two function definitions, as opposed to during the experiment itself. I use Builder myself, and would place this code in Begin Routine of the routine where the experiment is waiting for a response.