Example MatLab script for writing trigger codes to the BioSemi USB trigger interface
 
 

The below MatLab script will write the trigger value '255' for 500 times with an interval of 0,5 seconds.

 

 

usb = serial('/dev/ttyUSB1','BaudRate',115200,'DataBits',8, 'StopBits', 1, 'Parity', 'none');
% The trigger interface is recognized by the PC as a serial Com-port.
% You can connect to the trigger interface with the following settings:
% Data Rate: 115200
% Data Bits: 8
% Stop Bits: 1
% Parity: none
% Flow Control: off
get(usb);

fopen(usb);
% start experiment
for ii=1:500

 
  fwrite(usb,255);
pause(0.5)
end
% end experiment
fclose(usb);