DigitalIO Test
Connect A0 to LED sensor
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.
hwinfo = daqhwinfo(dio);
fprintf('DIO Info:\n');
disp(hwinfo);
fprintf('\nPorts:\n');
for p = hwinfo.Port
disp(p)
end
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'
putvalue(dio.Line(1),1);
pause(2);
putvalue(dio.Line(1),0);
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