Hello Oly,
I tried the code you shared, but I wasn't able to replicate the issue.
Here's the code, formatted so that it can be executed by itself with Bpod open:
`WindowForLickTimes = 0.5;
sma = NewStateMachine;
sma = SetGlobalTimer(sma, 'TimerID',1,'Duration', WindowForLickTimes);
sma = SetGlobalTimer(sma, 'TimerID',2,'Duration', WindowForLickTimes);
sma = AddState(sma,'Name','CountForLeftLick_FirstLick', ...
'Timer', 0,...
'StateChangeConditions', {'Tup','CountForLeftLick'},...
'OutputActions', {'GlobalTimerTrig',1});
sma = AddState(sma,'Name','CountForRightLick_FirstLick', ...
'Timer', 0,...
'StateChangeConditions', {'Tup','CountForRightLick'},...
'OutputActions', {'GlobalTimerTrig',2});
sma = AddState(sma,'Name','CountForLeftLick', ...
'Timer', 1,...
'StateChangeConditions', {'Tup','>exit'},...
'OutputActions', {});
sma = AddState(sma,'Name','CountForRightLick', ...
'Timer', 1,...
'StateChangeConditions', {'Tup','>exit'},...
'OutputActions', {});
SendStateMachine(sma);
RawEvents = RunStateMachine;
TE = struct;
TE = AddTrialEvents(TE, RawEvents);
disp(TE.RawEvents.Trial{1}.Events)`
The output I see is:
GlobalTimer1_Start: 1.0000e-04
Tup: [1.0000e-04 1.0001]
GlobalTimer1_End: 0.5000
Please let me know if you see something different.
Thanks,
Josh