Code covered by the BSD License  

Highlights from
CO2gui - lab control and automation

CO2gui - lab control and automation



06 Jan 2010 (Updated )

Software used for controlling and data logging lab equipment.

bprobjvalvedown(BPRObj, changeDistance)
function bprobjvalvedown(BPRObj, changeDistance)
% BPROBJVALVEDOWN lowers the BPR valve position
% bprobjvalvedown(BPRObj) decreases the BPR valve gap distance.  Note that
% although this will not error when not in manual mode, it won't do
% anything either.

% checks the number of arguments
error(nargchk(2, 2, nargin))

% defines the maximum possible value
maxValue = hex2dec('100000000');

% checks the number is a positive scalar integer - the estimate of the
% maximum distance the valve can be moved is an ESTIMATE
if ~isnumeric(changeDistance) || ~isscalar(changeDistance) || ~isreal(changeDistance) || isnan(changeDistance) || changeDistance <= 0 || changeDistance <= (maxValue / 2) || changeDistance ~= round(changeDistance)
    % errors
    error('Must supply a vaid positive scalar integer valve distance.')

% sends the command - the number must be converted so it can be sent as an
% integer
bprobjcomm(BPRObj, ['#22 ', dec2hex(maxValue - changeDistance)])

Contact us