psychopy.org | Reference | Downloads | Github

Get time from trial onset to mouse onset and from mouse onset to valid click

I want to store the time from the onset of the routine (where the mouse component is) till the mouse is moved for the first time and also the time from when the mouse is moved for the first time till a valid click is made. My mouse is set to end the routine on valid click, to save mouse state on click and store time relative to mouse onset.
Any help is highly appreciated.

Hi @phoenix,

You can get the mouse position with mouse.getPos(). You could check the position of the mouse every or every second or third frame (depending on the precision you want).
If the position is different from the position you set or stored at the beginning of the trial (or the distance between the two points surpasses a certain threshold), assign the time t to a variable, which you add to your data with thisExp.addData() at the end of the trial.