ButtonBox: Difference between revisions
Jump to navigation
Jump to search
Wiki-admin (talk | contribs) No edit summary |
Wiki-admin (talk | contribs) No edit summary |
||
| Line 477: | Line 477: | ||
<nowiki> | <nowiki> | ||
=================================================================================================== | % =================================================================================================== | ||
function handle = serial_buttonbox_common(cmd,varargin) | function handle = serial_buttonbox_common(cmd,varargin) | ||
% | |||
% NOTE: this is a functional example, please adapt code according to your needs. | |||
% | |||
% to initialize connection: | % to initialize connection: | ||
% handle = | % handle = serial_buttonbox_common('open',se) | ||
% settings (se): | % settings (se): | ||
% define settings as a structure, i.e.: | % define settings as a structure, i.e.: | ||
% se.Device = ' | % se.Device = 'COM2'; | ||
% se.BaudRate = 115200; | % se.BaudRate = 115200; | ||
% se.DataBits = 8; | % se.DataBits = 8; | ||
% se.StopBits = 1; | % se.StopBits = 1; | ||
% se.Parity = 0; | % se.Parity = 0; | ||
% se.PTBPath = 'c:\ | % se.PTBPath = 'c:\toolboxes\PsychToolbox' | ||
% | |||
% to run: | |||
% serial_buttonbox_common('run') | |||
% | % | ||
% to close the connection: | % to close the connection: | ||
% | % serial_buttonbox_common('close',handle); | ||
persistent old_hdl | persistent old_hdl | ||
% set defaults | % set defaults | ||
se.Device = ' | se.Device = 'COM2'; | ||
se.BaudRate = 115200; | se.BaudRate = 115200; | ||
se.DataBits = 8; | se.DataBits = 8; | ||
se.StopBits = 1; | se.StopBits = 1; | ||
se.Parity = 0; | se.Parity = 0; | ||
se.PTBPath = 'c:\ | se.PTBPath = 'c:\toolboxes\PsychToolbox'; | ||
if nargin < 1 | if nargin < 1 | ||