-
Notifications
You must be signed in to change notification settings - Fork 1
/
valveClose.m
45 lines (40 loc) · 1.04 KB
/
valveClose.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
function valveClose
% global AO
% global daqSession
% global optiStimChanInd; % LED/laser stim AO channel index
% global valveChanInd; % reward valve AO channel index
% global TRIAL
% global OFFLINE
% global EXP
[~, RIGNAME]=system('hostname');
if ~isempty(strfind(RIGNAME, 'ZAMBONI'))
daqVendorName = 'ni'; % this name is used for 64-bit interface
aoDeviceID='Dev1';
aoValveChannel = 'ao0';
dioID='Dev1';
dioCh=1;
dioPort=0;
optiStimChanInd=2;
valveChanInd=1;
elseif ~isempty(strfind(RIGNAME, 'ZMAZE'))
daqVendorName = 'ni'; % this name is used for 64-bit interface
aoDeviceID='Dev1';
aoValveChannel = 'ao0';
dioID='Dev1';
dioCh=1;
dioPort=0;
optiStimChanInd=2;
valveChanInd=1;
else
aoID='Dev1';
dioID='Dev1';
dioCh=1;
dioPort=0;
optiStimChanInd=1;
valveChanInd=2;
end
daqSession = daq.createSession(daqVendorName);
daqSession.addAnalogOutputChannel(aoDeviceID, aoValveChannel, 'Voltage');
daqSession.outputSingleScan(valveClosedVoltage);
stop(daqSession);
delete(daqSession);