Display experiment elapsed time for a specific time period
Hi,
I am trying to design an experiment where participants can check the elapsed time for 2 seconds upon a key press in different slides (I am hoping they can see the elapsed time no matter which slide they are in, e.g., fixation, stimulus, ITI, etc.).
I have placed the following in the user script as subroutine:
Dim g_experimentStartTimeMS As Double
Dim g_currentTimeMS As Double
Dim g_elapsedTimeMS As Double
Dim g_elapsedTimeMin As Long
Dim g_elapsedTimeSec As Long
Dim x As Integer
Sub GetExperimentStartTime
g_experimentStartTimeMS = Clock.Read
End Sub
Sub CalculateElapsedTime
g_currentTimeMS = Clock.Read
g_elapsedTimeMS = g_currentTimeMS - g_experimentStartTimeMS
g_elapsedTimeSec = (g_elapsedTimeMS \ 1000)
g_elapsedTimeMin = (g_elapsedTimeSec \ 60)
x = g_elapsedTimeSec - (g_elapsedTimeMin * 60)
If x > 0 Then
g_elapsedTimeSec = x
Else
g_elapsedTimeSec = 0
End If
End Sub
However, I am quite stuck when it comes to activate the subroutine and display "g_elapsedTimeSec" & "g_elapsedTimeMin" for exactly 2 seconds.
Sorry for my lack of knowledge in VBA.
Any help would be greatly appreciated.
Thanks!
Please sign in to leave a comment.
Comments
0 comments