Hello Josh and thank you a lot for your answer,
I will try to implement the strategy you propose and also try to be more familiar with the TrialManager that will likely facilitate my future akward tasks 🙂
A last quick question is about which Matlab command can I use to force the PWM1 to be ON when no state machine is running (similarly to what is done when clicking on LED boolean of the Bpod GUI Console) ?
I tried to set the PWM1 from 0 to 255 changing its corresponding value in BpodSystem.HardwareState.OutputOverride or OutputState, but it failed. How can I set it to remain ON without running a state machine ?
Cheers,
Vlad
Edit:
Just played with the TrialManager that seems convenient for my purpose, making the dead time between my two StateMachine negligible :
trialManager=BpodTrialManager;
SendStateMachine(StateMachine1)
trialManager.startTrial();
RawEventsTriggerState= trialManager.getCurrentEvents({'TriggerState'});
I added a 'Buffer' state named TriggerState to my StateMachine1 which allows the extraction of licks when this state is reached. I then compute the lick ratio on Matlab and send the desired following StateMachine2 while StateMachine1 still run :
if LickCountResponse>(2*LickCountBaseline)
SendStateMachine(StateMachine2Reward,'RunASAP')
else
SendStateMachine(StateMachine2NoReward,'RunASAP')
end
Thanks for your advices 😉