SoftCodeHandlerFunction

BpodSystem.SoftCodeHandlerFunction


Description

Equal to the full path of a soft code handler m-file to use with the current protocol.


Example


% Part 1 (in main protocol file): This single-state matrix sends a byte (3) back to the governing computer on state entry by setting a 'SoftCode' in Output Actions.

sma = NewStateMachine();

sma = AddState(sma, 'Name', 'State1', ...
    'Timer', 1,...
    'StateChangeConditions', {'Tup', 'exit'},...
    'OutputActions', {'SoftCode', 3});


% Part 2 (in main protocol file): This code specifies which file will handle the byte when it comes back.

BpodSystem.SoftCodeHandlerFunction = 'SoftCodeHandler_Printout';


% Part 3 (separate file in protocol folder): This code handles the byte by printing it to the MATLAB command window.

function SoftCodeHandler_Printout(Byte)
disp(Byte);

% For another example of a soft code handler, 
% see /Bpod/Examples/Protocols/PsychToolboxSound/SoftCodeHandler_PlaySound.m

Comments