SendStateMachine()

Description

Sends a state machine description to a Bpod state machine device.

  • The state machine description is checked first for sanity, and an error is thrown if parameters are invalid, states were referred to but not subsequently defined, etc.

  • The function returns an acknowledgement that the data was properly formatted and cued for transmission.

    • SuccessfulTransmission is verified internally on the next call to RunStateMachine().

Syntax

Acknowledged = SendStateMachine(StateMachineStruct)

Parameters

  • StateMachineStruct: The state machine struct to be sent.

    • Note: state machine structs are created with NewStateMachine() and states are added with AddState().

Returns

  • 1 if cued for transmission successfully, 0 if not.

Example

% This code generates a simple state machine and sends it to Bpod.

sma = NewStateMachine();

sma = AddState(sma, 'Name', 'State1', ...

'Timer', 1,...

'StateChangeConditions', {'Tup', 'exit'},...

'OutputActions', {});

SendStateMachine(sma);