Code covered by the BSD License  

Highlights from
CO2gui - lab control and automation

CO2gui - lab control and automation

by

 

06 Jan 2010 (Updated )

Software used for controlling and data logging lab equipment.

rheodyneobjstatus(rheodyneTimer)
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.')
end

% 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.')
end

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

catch
    % 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;
end

Contact us