-
Notifications
You must be signed in to change notification settings - Fork 1
/
testOptoLED.m
50 lines (39 loc) · 1.03 KB
/
testOptoLED.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
%test DAQ
intUseDaqDevice = 1;
%% open
dblSampRate = 10000;
objDAQOut = openDaqOutputOptoSpritzer(intUseDaqDevice,dblSampRate);
%% prepare
dblV1 = 0;
dblV2 = 3;
dblV3 = 0;
dblDur1 = 0.010;
dblDur2 = 0.500;
outputData0 = cat(1,linspace(dblV1, dblV1, round(dblSampRate*dblDur1))',linspace(dblV2, dblV2, round(dblSampRate*dblDur2))',linspace(dblV3, dblV3, round(dblSampRate*dblDur1))');
%prepare
dblStimReps = 5;
dblHz = 10;
vecOff = dblV1*ones(round(dblSampRate/(dblHz*2)),1);
vecOn = dblV2*ones(round(dblSampRate/(dblHz*2)),1);
vecStim = repmat(cat(1,vecOff,vecOn),[dblStimReps 1]);
outputData1 = cat(1,vecStim,vecOff);
stop(objDAQOut);
queueOutputData(objDAQOut,[outputData1 outputData1]);
prepare(objDAQOut);
%wait & send
pause(0.1);
startBackground(objDAQOut)
disp('signal start');
pause(numel(outputData1)/dblSampRate);
disp('signal end');
%% close
closeDaqOutput(objDAQOut);
try
queueOutputData(objDAQOut,[0 0]);
startBackground(objDAQOut);
pause(0.1);
catch
end
%% close connection
try,stop(objDAQOut);catch,end
closeDaqOutput(objDAQOut);