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.

function status = rheodyneobjstatus(rheodyneTimer)
% RHEODYNEOBJSTATUS gets the current status of the rheodyne timer object
% status = rheodynestatus(rheodyneTimer) reads the current timer period
% of the Rheodyne timer.  rheodyneTimer is the timer object (generated by
% rheodyneobj). status is 1 if the timer is running, and 0 if it is not.

% e.g. status = rheodyneobjstatus(rheodyneobj) - returns the current
% status of the rheodyne timer, e.g. 1 for if is running.

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

% error handling
if length(rheodyneTimer) > 1 || ~isvalid(rheodyneTimer)
    % errors
    error('rheodyneTimer must be a valid scalar timer object.')
elseif ~strcmp(rheodyneTimer.Tag, 'rheodyne')
    % errors
    error('Incorrect timer - the timer must be generated from rheodyneobj.')

% gets the user data
userData = rheodyneTimer.UserData;

% more error handling
if ~isfield(userData, 'audioPlayerObject')
    % error
    error('audioPlayerObject is missing from the timer UserData.')
elseif ~isa(userData.audioPlayerObject, 'audioplayer')
    % error
    error('audioPlayerObject in timer UserData is not an audioplayer object.')

% returns the response
    % gets it
    status = strcmp(get(userData.audioPlayerObject, 'Running'), 'on');

    % the audioplayer object is probably broken
    %error('rheodyneObjStatus:brokenAudioObject', 'Rheodyne audioplayer object does not appear to be working correctly.')
    % define it as 0
    stauts = 0;

Contact us