OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 3.1.0
Standard Standalone? (y/n) If not then what?: Y
What are you trying to achieve?:
I am trying to send parallel port triggers exactly as the response buttons are pressed.
I have used a builder component with the following set up:
When the parallel port component is positioned before the keyboard component, the delay between the response time in the output file and the parallel port trigger is about 13 ms which equates to 2 frames.
When the parallel port component is positioned after the keyboard component. the delay is about 6.7 ms which equates to 1 frame.
What did you try to make it work?:
I have looked at a previous thread:
It suggests to remove the following parts of code in relation to the parallel port component:
Originally my coder view script looked like this:
What specifically went wrong when you tried that?:
I removed the
callOnFlip commands and run the task again (from the coder view) but the delay was still there.
This was the code:
# *p_port_prac1b* updates if (prac_resp.keys == 'm' or prac_resp.keys == 'c' or prac_resp.status == FINISHED) and p_port_prac1b.status == NOT_STARTED: # keep track of start time/frame for later p_port_prac1b.tStart = t # not accounting for scr refresh p_port_prac1b.frameNStart = frameN # exact frame index win.timeOnFlip(p_port_prac1b, 'tStartRefresh') # time at next scr refresh p_port_prac1b.status = STARTED if p_port_prac1b.status == STARTED and t >= (p_port_prac1b.tStart + 0.05): # keep track of stop time/frame for later p_port_prac1b.tStop = t # not accounting for scr refresh p_port_prac1b.frameNStop = frameN # exact frame index win.timeOnFlip(p_port_prac1b, 'tStopRefresh') # time at next scr refresh p_port_prac1b.status = FINISHED
I also unticked the option
Sync to screen in the builder component, but again, the delay persisted.
In the tab
Data there is another option called
Sync timing with screen refresh which I had ticked. When I unticked it, the trigger timings were completely bizarre and not related to responses.
Should I change something else in the code? Or is there a way to fix this within the builder component?