I’m programming a psychology experiment using jsPsych and P5. Participants should see a stimulus on the screen, make a decision, press a button, and get feedback on the accuracy of their response before moving on to the next stimulus.
The problem is, some keypresses are ignored for some reason. I think this mostly happens if you press the same key for two stimuli in a row, but it also happens on other occasions. I suspect this is not a problem with jsPsych because when I ask p5 to console.log the keycode after every keypress, these keypresses are not printed in the console.
It seems to work okay when I remove the p.remove from the p.keyPressed function. I guess p5 needs to record the key release in order to be able to record the next keypress, even if the next press is in a new p5 instance?
were able to get through this? Please share how you solved. I am making a tool similar to https://spacebarclicker.info and my spacebar presses are getting ignored for some reason. I have tried removing p.remove but it did not work. Please help!