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.

gilsonpumpobjgui(varargin)
function varargout = gilsonpumpobjgui(varargin)
% GILSONPUMPOBJGUI M-file for gilsonpumpobjgui.fig
%      GILSONPUMPOBJGUI, by itself, creates a new GILSONPUMPOBJGUI or raises the existing
%      singleton*.
%
%      H = GILSONPUMPOBJGUI returns the handle to a new GILSONPUMPOBJGUI or the handle to
%      the existing singleton*.
%
%      GILSONPUMPOBJGUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in GILSONPUMPOBJGUI.M with the given input arguments.
%
%      GILSONPUMPOBJGUI('Property','Value',...) creates a new GILSONPUMPOBJGUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before gilsonpumpobjgui_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to gilsonpumpobjgui_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help gilsonpumpobjgui

% Last Modified by GUIDE v2.5 19-Aug-2009 10:36:04

% Begin initialization code - DO NOT EDIT
gui_Singleton = 0;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @gilsonpumpobjgui_OpeningFcn, ...
                   'gui_OutputFcn',  @gilsonpumpobjgui_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before gilsonpumpobjgui is made visible.
function gilsonpumpobjgui_OpeningFcn(hObject, eventdata, handles, mainGuiHandle, serialObj)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to gilsonpumpobjgui (see VARARGIN)

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

% stashes away the main gui handle
handles.mainGuiHandle = mainGuiHandle;

% stashes away the serial object for future use
handles.serialObj = serialObj;

% defines the collect data flag field
collectDataFlag = sprintf('collectDataFlag%d', serialObj.UserData.objectNumber);

% turns the collect data flag off temporarily - this is necessary to prevent the
% serial timer interrupting the collection of all the data
setappdata(mainGuiHandle, collectDataFlag, 0)

% Update handles structure
guidata(hObject, handles);

% defines a blank selection
selection = '';

% try-catches everything in case something interrupts any of the commands
% (as the whole thing takes quite a long time)
try
    % starts a waitbar
    waitBarHandle = waitbar(0, 'Retrieving information (this will take approximately 10 seconds)...');
    
    % sets the pointer to an hourglass
    set(hObject, 'Pointer', 'watch')

    % gets the main GUI handles
    mainGuiHandles = guidata(mainGuiHandle);
    
    % fetches the flow rate from the mainGui (assuming the flow rate box is
    % filled)
    flowRate = str2double(get(mainGuiHandles.(sprintf('flow%d', serialObj.UserData.objectNumber)), 'String'));
    
    % it it wasn't a NaN or 0, fill the consumption time box
    if ~isnan(flowRate) && flowRate
        % fill the box
        set(handles.consumptionTime, 'String', sprintf('%.1f', ((2.5 * 1000) / flowRate) / 60))
    end
    
    % updates waitbar
    waitbar(1 / 9, waitBarHandle)
    
    % fetches the pump setup
    [refillTime, compressibility, pumpHeadSize, inletPress] = gilsonpumpobjreadpumpsetup(serialObj);
    
    % fills the refill time
    set(handles.refillTime, 'String', num2str(refillTime))
    
    % fills the pump head size
    set(handles.pumpHeadSize, 'String', num2str(pumpHeadSize))
    
    % fills the inlet pressure
    set(handles.inletPress, 'String', num2str(inletPress))
    
    % updates waitbar
    waitbar(4 / 9, waitBarHandle)
    
    % gets the maximum possible pressure (feeding the pumpHeadSize in so
    % that it doesn't have to be read again)
    [maxPossiblePress, manometricModule] = gilsonpumpobjreadmaxpossiblepress(serialObj, '', pumpHeadSize);

    % updates waitbar
    waitbar(5 / 9, waitBarHandle)

    % fills the manometric module box
    set(handles.manometricModule, 'String', manometricModule)
    
    % fills the maximum possible pressure box
    set(handles.maxPossiblePress, 'String', num2str(maxPossiblePress))
    
    % if there is no manometric module connected, disable the boxes which
    % cannot be filled, otherwise, enable and fill them
    if strcmp(manometricModule, 'None')
        % disables boxes
        set([   handles.compressibility,...
                handles.minPress,...
                handles.maxPress], 'Enable', 'off')
        
    else
        % enables and fills the compressibility box
        set(handles.compressibility, 'String', num2str(compressibility), 'Enable', 'on')

        % updates waitbar
        waitbar(6 / 9, waitBarHandle)
        
        % fetches the minium and maximum pressures
        [minPress, maxPress] = gilsonpumpobjreadpresssetup(serialObj);

        % enables and fills the minimum pressure box
        set(handles.minPress, 'String', num2str(minPress), 'Enable', 'on')

        % updates waitbar
        waitbar(7 / 9, waitBarHandle)

        % enables and fills the maximum pressure box
        set(handles.maxPress, 'String', num2str(maxPress), 'Enable', 'on')

        % updates waitbar
        waitbar(8 / 9, waitBarHandle)
    end

    % finds out if the keypad is locked or not
    set(handles.keypad, 'Value', gilsonpumpobjkeypadlockstatus(serialObj))

    % updates waitbar
    waitbar(1, waitBarHandle)
    
catch
    % brings up an question dialog to ask use what they want to do if the
    % data couldn't be fetched
    selection = questdlg(   'The Gilson pump configuration could not be retrieved.  Would you like to continue anyway?',...
                            'More Options Menu Confirmation',...
                            'Yes', 'No',...
                            'Yes');
end

% sets the pointer back to an arrow
set(hObject, 'Pointer', 'arrow')

% closes waitbar
close(waitBarHandle)

% turns the collect data flag back on
setappdata(mainGuiHandle, collectDataFlag, 1)

% close the GUI if 'No' was selected
if strcmp(selection, 'No')
    % deletes the GUI
    delete(hObject)
end


% --- Outputs from this function are returned to the command line.
function gilsonpumpobjgui_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in readPumpManual.
function readPumpManual_Callback(hObject, eventdata, handles)
% hObject    handle to readPumpManual (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% opens the pump manual
open('Gilson 305 User''s Guide.pdf')


% --- Executes on button press in readProtocols.
function readProtocols_Callback(hObject, eventdata, handles)
% hObject    handle to readProtocols (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% if its a pc
if ispc
    % opens the protocols document
    winopen('GSIOC Protocols.docx')
else
    % displays an info box with the path to the document in
    msgbox(['The document can be be found in: ', fileparts(mfilename('fullpath')), '\GSIOC Protocols.docx'], 'Information')
end


% --- Executes on button press in readPumpHeadManual.
function readPumpHeadManual_Callback(hObject, eventdata, handles)
% hObject    handle to readPumpHeadManual (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% opens the pump head manual
open('Gilson SC-type Piston Pump Heads Manual.pdf')



function pumpHeadSize_Callback(hObject, eventdata, handles)
% hObject    handle to pumpHeadSize (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of pumpHeadSize as text
%        str2double(get(hObject,'String')) returns contents of pumpHeadSize as a double

% gets string
pumpHeadSize = str2double(get(hObject, 'String'));

% checks its OK
if all(~ismember([5, 10, 25, 50, 100, 200], pumpHeadSize))
    % brings up an error dialog
    warntooltip(hObject, 'Pump head size must be 5, 10, 25, 50, 100 or 200.')
else
    % sends the command
    try
        % brings up a waitbar
        waitBarHandle = waitbar(1 / 3, 'Writing pump head size...');
        
        % defines the parent
        parent = getfigure(hObject);

        % sets the pointer to an hourglass
        set(parent, 'Pointer', 'watch')

        % sends the command
        gilsonpumpobjwritepumpheadsize(handles.serialObj, pumpHeadSize)
        
        % updates waitbar
        waitbar(2 / 3, waitBarHandle)
        
        % recalculates the maximum possible pressure
        set(handles.maxPossiblePress, 'String', num2str(gilsonpumpobjreadmaxpossiblepress(handles.serialObj)))
        
        % updates waitbar
        waitbar(1, waitBarHandle)
    catch
        % errors
        errortooltip(hObject, 'Could not set pump head size.')
    end
    
    % sets the pointer back to an arrow
    set(parent, 'Pointer', 'arrow')

    % closes waitbar
    close(waitBarHandle)
end


% --- Executes during object creation, after setting all properties.
function pumpHeadSize_CreateFcn(hObject, eventdata, handles)
% hObject    handle to pumpHeadSize (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function refillTime_Callback(hObject, eventdata, handles)
% hObject    handle to refillTime (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of refillTime as text
%        str2double(get(hObject,'String')) returns contents of refillTime as a double

% gets string
refillTime = str2double(get(hObject, 'String'));

% checks its OK
if ~isnumberbetween(refillTime, 125, 1000) || ~isInteger(refillTime)
    % brings up an error dialog
    warntooltip(hObject, 'Refill time must be an integer from 125 to 1000.')
else
    % sends the command
    try
        % brings up a waitbar
        waitBarHandle = waitbar(0.5, 'Writing refill time...');
        
        % defines the parent
        parent = getfigure(hObject);

        % sets the pointer to an hourglass
        set(parent, 'Pointer', 'watch')

        % sends the command
        gilsonpumpobjwriterefilltime(handles.serialObj, refillTime)
        
        % updates waitbar
        waitbar(1, waitBarHandle)
    catch
        % errors
        errortooltip(hObject, 'Could not set refill time.')
    end
    
    % sets the pointer back to an arrow
    set(parent, 'Pointer', 'arrow')

    % closes waitbar
    close(waitBarHandle)
end


% --- Executes during object creation, after setting all properties.
function refillTime_CreateFcn(hObject, eventdata, handles)
% hObject    handle to refillTime (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function maxPress_Callback(hObject, eventdata, handles)
% hObject    handle to maxPress (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of maxPress as text
%        str2double(get(hObject,'String')) returns contents of maxPress as a double

% gets string
maxPress = str2double(get(hObject, 'String'));

% gets the maximum possible pressure
maxPossiblePress = get(handles.maxPossiblePress, 'String');

% checks its OK
if ~isnumberbetween(maxPress, 0, str2double(maxPossiblePress)) || ~isInteger(maxPress)
    % brings up an error dialog
    warntooltip(hObject, sprintf('Maximum pressure must be an integer from 0 to %s.', maxPossiblePress))
else
    % sends the command
    try
        % brings up a waitbar
        waitBarHandle = waitbar(0.5, 'Writing maximum pressure...');
        
        % defines the parent
        parent = getfigure(hObject);

        % sets the pointer to an hourglass
        set(parent, 'Pointer', 'watch')
       
        % sends the command
        gilsonpumpobjwritemaxpress(handles.serialObj, maxPress)
        
        % updates waitbar
        waitbar(1, waitBarHandle)
    catch
        % errors
        errortooltip(hObject, 'Could not set maximum pressure.')
    end
    
    % sets the pointer back to an arrow
    set(parent, 'Pointer', 'arrow')

    % closes waitbar
    close(waitBarHandle)
end


% --- Executes during object creation, after setting all properties.
function maxPress_CreateFcn(hObject, eventdata, handles)
% hObject    handle to maxPress (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function command_Callback(hObject, eventdata, handles)
% hObject    handle to command (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of command as text
%        str2double(get(hObject,'String')) returns contents of command as a double


% --- Executes during object creation, after setting all properties.
function command_CreateFcn(hObject, eventdata, handles)
% hObject    handle to command (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function response_Callback(hObject, eventdata, handles)
% hObject    handle to response (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of response as text
%        str2double(get(hObject,'String')) returns contents of response as a double


% --- Executes during object creation, after setting all properties.
function response_CreateFcn(hObject, eventdata, handles)
% hObject    handle to response (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function manometricModule_Callback(hObject, eventdata, handles)
% hObject    handle to manometricModule (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of manometricModule as text
%        str2double(get(hObject,'String')) returns contents of manometricModule as a double


% --- Executes during object creation, after setting all properties.
function manometricModule_CreateFcn(hObject, eventdata, handles)
% hObject    handle to manometricModule (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function minPress_Callback(hObject, eventdata, handles)
% hObject    handle to minPress (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of minPress as text
%        str2double(get(hObject,'String')) returns contents of minPress as a double

% gets string
minPress = str2double(get(hObject, 'String'));

% gets the maximum possible pressure
maxPossiblePress = get(handles.maxPossiblePress, 'String');

% checks its OK
if ~isnumberbetween(minPress, 0, str2double(maxPossiblePress)) || ~isInteger(minPress)
    % brings up an error dialog
    warntooltip(hObject, sprintf('Minimum pressure must be an integer from 0 to %s.', maxPossiblePress))
    
else
    % sends the command
    try
        % brings up a waitbar
        waitBarHandle = waitbar(0.5, 'Writing minimum pressure...');
        
        % defines the parent
        parent = getfigure(hObject);

        % sets the pointer to an hourglass
        set(parent, 'Pointer', 'watch')

        % sends the command
        gilsonpumpobjwriteminpress(handles.serialObj, minPress)
        
        % updates waitbar
        waitbar(1, waitBarHandle)
    catch
        % errors
        errortooltip(hObject, 'Could not set minimum pressure.')
    end
    
    % sets the pointer back to an arrow
    set(parent, 'Pointer', 'arrow')

    % closes waitbar
    close(waitBarHandle)
end


% --- Executes during object creation, after setting all properties.
function minPress_CreateFcn(hObject, eventdata, handles)
% hObject    handle to minPress (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function inletPress_Callback(hObject, eventdata, handles)
% hObject    handle to inletPress (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of inletPress as text
%        str2double(get(hObject,'String')) returns contents of inletPress as a double

% gets string
inletPress = str2double(get(hObject, 'String'));

% gets maximum possible pressure
maxPossiblePress = str2double(get(handles.maxPossiblePress, 'String'));

% checks its OK
if ~isnumberbetween(inletPress, 0, maxPossiblePress) || ~isInteger(inletPress)
    % brings up an error dialog
    warntooltip(hObject, sprintf('Inlet pressure must be an integer from 0 to %d.', maxPossiblePress))
else
    % sends the command
    try
        % brings up a waitbar
        waitBarHandle = waitbar(0.5, 'Writing inlet pressure...');
        
        % defines the parent
        parent = getfigure(hObject);

        % sets the pointer to an hourglass
        set(parent, 'Pointer', 'watch')
        
        % sends the command
        gilsonpumpobjwriteinletPress(handles.serialObj, inletPress)
        
        % updates waitbar
        waitbar(1, waitBarHandle)
    catch
        % errors
        errortooltip(hObject, 'Could not set inlet pressure.')
    end
    
    % sets the pointer back to an arrow
    set(parent, 'Pointer', 'arrow')

    % closes waitbar
    close(waitBarHandle)
end


% --- Executes during object creation, after setting all properties.
function inletPress_CreateFcn(hObject, eventdata, handles)
% hObject    handle to inletPress (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --- Executes on button press in readRadio.
function readRadio_Callback(hObject, eventdata, handles)
% hObject    handle to readRadio (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of readRadio

% always checks itself if clicked to prevent it from being unchecked
set(hObject, 'Value', 1)


% --- Executes on button press in writeRadio.
function writeRadio_Callback(hObject, eventdata, handles)
% hObject    handle to writeRadio (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of writeRadio

% always checks itself if clicked to prevent it from being unchecked
set(hObject, 'Value', 1)


% --- Executes on button press in keypad.
function keypad_Callback(hObject, eventdata, handles)
% hObject    handle to keypad (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of keypad

% defines the parent
parent = getfigure(hObject);

% sets the pointer to an hourglass
set(parent, 'Pointer', 'watch')

% if ticked, send one command, otherwise, send a different one
if get(hObject, 'Value')
    try
        % brings up a waitbar
        waitBarHandle = waitbar(0.5, 'Locking keypad...');

        % sends the command
        gilsonpumpobjlockkeypad(handles.serialObj)

        % updates waitbar
        waitbar(1, waitBarHandle)
    catch
        % errors
        errordlg('Could not lock keypad.')
    end
else
    try
        % brings up a waitbar
        waitBarHandle = waitbar(0.5, 'Unlocking keypad...');

        % sends the command
        gilsonpumpobjunlockkeypad(handles.serialObj)

        % updates waitbar
        waitbar(1, waitBarHandle)
    catch
        % errors
        errordlg('Could not unlock keypad.')
    end
end

% sets the pointer back to an arrow
set(parent, 'Pointer', 'arrow')

% closes waitbar
close(waitBarHandle)


function compressibility_Callback(hObject, eventdata, handles)
% hObject    handle to compressibility (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of compressibility as text
%        str2double(get(hObject,'String')) returns contents of compressibility as a double

% gets string
compressibility = str2double(get(hObject, 'String'));

% checks its OK
if isnan(compressibility) || ~isreal(compressibility) || compressibility < 0 || compressibility > 2000 || compressibility ~= round(compressibility)
    % brings up an error dialog
    errordlg('Compressibility must be a real integer from 0 to 2000.')
else
    % sends the command
    try
        % brings up a waitbar
        waitBarHandle = waitbar(0.5, 'Writing compressibility...');
        
        % defines the parent
        parent = getfigure(hObject);

        % sets the pointer to an hourglass
        set(parent, 'Pointer', 'watch')
        
        % sends the command
        gilsonpumpobjwritecompressibility(handles.serialObj, compressibility)
        
        % updates waitbar
        waitbar(1, waitBarHandle)
    catch
        % errors
        errordlg('Could not set compressibility.')
    end
    
    % sets the pointer back to an arrow
    set(parent, 'Pointer', 'arrow')

    % closes waitbar
    close(waitBarHandle)
end



% --- Executes during object creation, after setting all properties.
function compressibility_CreateFcn(hObject, eventdata, handles)
% hObject    handle to compressibility (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function maxPossiblePress_Callback(hObject, eventdata, handles)
% hObject    handle to maxPossiblePress (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of maxPossiblePress as text
%        str2double(get(hObject,'String')) returns contents of maxPossiblePress as a double


% --- Executes during object creation, after setting all properties.
function maxPossiblePress_CreateFcn(hObject, eventdata, handles)
% hObject    handle to maxPossiblePress (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --- Executes on button press in sendButton.
function sendButton_Callback(hObject, eventdata, handles)
% hObject    handle to sendButton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% deviceID
deviceID = 1;

% gets the command type
if get(handles.readRadio, 'Value')
    % sends the command and fills the response box
    set(handles.response, 'String', gilsonobjcomm('read', handles.serialObj, deviceID, get(handles.command, 'String')))
else
    % sends the command
    gilsonobjcomm('read', handles.serialObj, deviceID, get(handles.command, 'String'))
    
    % empties the response box
    set(handles.response, 'String', '')
end


function consumptionTime_Callback(hObject, eventdata, handles)
% hObject    handle to consumptionTime (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of consumptionTime as text
%        str2double(get(hObject,'String')) returns contents of consumptionTime as a double


% --- Executes during object creation, after setting all properties.
function consumptionTime_CreateFcn(hObject, eventdata, handles)
% hObject    handle to consumptionTime (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

Contact us