Josh wrote[quote='Josh' pid='1387' dateline='1583717647']
Hi Josh,
thank you so much for this! Unfortunately, when I run the modified code I continue to get the same error messages. which are as follows:
Error using AddState>EventSpellingErrorMessage (line 267)
Check spelling of your state transition events for state: . Valid events (% is an index): Port%In Port%Out BNC%High
BNC%Low Wire%High Wire%Low SoftCode% GlobalTimer%End Tup
Error in AddState (line 164)
EventSpellingErrorMessage(ThisStateName);
Error in TTLpulse (line 72)
sma = AddState(sma, 'Name', 'Trigger1', 'Timer', 0, 'StateChangeConditions', {'BNC1', 1}, 'OutputActions', {});
Error in run (line 91)
evalin('caller', strcat(script, ';'));
Error in NewLaunchManager>LaunchProtocol (line 707)
run(ProtocolPath);
Error while evaluating DestroyedObject Callback.
I have double checked that I am using the correct protocol and data path, so its not that. Also, this EventSpellingErrorMessage has me quite puzzled since I have tried changing numerous things and it is always the same message (this error has been consistent throughout my protocol development.
thanks again for the help.
Cheers,
K8
-=-=-=-=-=-=-=-=-=-----
END MESSAGE
---=-=-=-=-=-=-=-=-=-=--------
Hi K8flr,
Can you please share the error messages you're seeing?
One thing I'd point out - if you don't need a settings struct, you can remove all code referring to it. I'm actually not sure how that plugin handles the case where you pass an empty struct. Also, in your output actions, the state of 'BNC1' must be either 0 or 1 (for low and high). With those changes, your code becomes:
function TTLpulse
global BpodSystem
MaxTrials = 10;
for currentTrial = 1:MaxTrials
sma = NewStateMachine()
sma = AddState(sma, 'Name', 'Trigger1', 'Timer', 0, 'StateChangeConditions', {'BNC1', 1}, 'OutputActions', {});
sma = AddState(sma, 'Name', 'Delay', 'Timer', 10, 'StateChangeConditions', {'Tup', 'exit'}, 'OutputActions', {});
SendStateMatrix(sma);
RawEvents = RunStateMatrix;
end
end
-Josh