utils.marker.port_writer

stroop_task.utils.marker.port_writer(port, data, pulsewidth=0.01)

Writes data to a serial port with a specified pulse width.

This function is typically used for writing to the BrainVision trigger box. It writes the actual data to the port, waits for the specified pulse width, and then writes a zero byte to the port.

Parameters

Name Type Description Default
port serial.Serial The serial port object to which the data will be written. required
data list[int] | int The data to be written to the serial port. Can be a single integer or a list of integers. required
pulsewidth float The duration in seconds to wait between writing the actual data and the zero byte. Default is 0.01 seconds. 0.01

Returns

Name Type Description
int The number of bytes written to the serial port.