DigitalIO Test

 Connect A0 to LED sensor
% Create digital I/O object
dio = digitalio('mcc',0);
disp(dio);
Display Summary of DigitalIO (DIO) Object Using 'USB-1208FS'.

         Port Parameters:  Port 0 is port configurable for reading and writing.
                           Port 1 is port configurable for reading and writing.
                           
           Engine status:  Engine not required.

DIO object contains no lines.

% Display the line characteristics of each port

hwinfo = daqhwinfo(dio);
fprintf('DIO Info:\n');
disp(hwinfo);

% show port infomation
fprintf('\nPorts:\n');

for p = hwinfo.Port
    disp(p)
end


% add digital I/O lines to MATLAB
addline(dio,0:3,'out')
DIO Info:
                AdaptorName: 'mcc'
                 DeviceName: 'USB-1208FS'
                         ID: '0'
                       Port: [1x2 struct]
              SubsystemType: 'DigitalIO'
                 TotalLines: 16
    VendorDriverDescription: [1x39 char]
        VendorDriverVersion: '5.9'


Ports:
           ID: 0
      LineIDs: [0 1 2 3 4 5 6 7]
    Direction: 'in/out'
       Config: 'port'

           ID: 1
      LineIDs: [0 1 2 3 4 5 6 7]
    Direction: 'in/out'
       Config: 'port'


   Index:  LineName:  HwLine:  Port:  Direction:  
   1       ''         0        0      'Out'       
   2       ''         1        0      'Out'       
   3       ''         2        0      'Out'       
   4       ''         3        0      'Out'       

% turn on A0 for 2 seconds
putvalue(dio.Line(1),1);
pause(2);
putvalue(dio.Line(1),0);
% Use Timer and callback function to flash LED
set(dio,'TimerFcn',@mycallback);
set(dio,'TimerPeriod',0.25);
start(dio);
pause(5);
stop(dio);
putvalue(dio.Line(1),0);
for obj=daqfind
    delete(obj);
end
clear dio obj