LoadSerialMessages()
Description
When building a state machine, The output action {"Serial1", N} can trigger byte N to be sent to a connected module named 'Serial1'.
N can also specify a string of 1-3 bytes.
This function loads byte strings for different output bytes on the UART serial channels.
Syntax
Acknowledged = LoadSerialMessages(SerialPort, Messages, [MessageIndexes])
Parameters
SerialPort: The UART serial port number (1-2 on Bpod 0.5, 1-3 on Bpod 0.7, 1-5 on Bpod Pocket State Machine)
If a recognized Bpod module is on the port, you can also use its name as a string (e.g. 'ValveModule1')
Messages: A cell array of messages
(optional) MessageIndexes: A list of indexes for the byte strings in the Messages argument.
By default, the indexes of Messages are consecutive.
Returns
Acknowledged: 1 if messages successfully transmitted, 0 if not
Examples
% Example1: Loads [5 8] as message#1, and [2 3 4] as message#2 on UART serial port 1
LoadSerialMessages(1, {[5 8], [2 3 4]});
% Example2: Loads ['X' 3] as message#8 on UART serial port 3
LoadSerialMessages(3, ['X' 3], 8);