-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_bits.m
118 lines (94 loc) · 3.79 KB
/
setup_bits.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
% This script sets up the Bitsi boxes - on for the button boxes, one for the scanner-triggers
% It assumes that there is a SCANNER variable
% SCANNER = {'Skyra','Dummy','Debugging','Keyboard'}; SCANNER = SCANNER{3};
switch SCANNER
case 'Skyra'
%Set WD
%cd wd;
%Set trigger
scannertrigger = 97;
%Set output/input comports
bitsiboxScanner = Bitsi('/dev/ttyS1');
bitsiboxButtons = Bitsi('/dev/ttyS5');
% %Set trigger
% scannertrigger = 15; %key "a"
%
% %Set comports to KB
% bitsiboxScanner = Bitsi('');
% bitsiboxButtons = Bitsi('');
% bitsiEye = Bitsi('');
% Right hand -- button down
ButtonA = 11; % left
ButtonB = 12; % right
%Bitsi test script
% a = 1;
% while a
%
% %Clear keyboard
% [response, keyDownTimestamp] = bitsiboxScanner.getResponse(0.001, true);
% while response %%>>>>>>>>>>>>>>>>>> DO SOMETHING WITH SCANNER PULSE<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<%%
% [response, keyDownTimestamp] = bitsiboxScanner.getResponse(0.001, true);
% end
%
% %Ask for response
% while (response == 0)
% [response, ~] = bitsiboxScanner.getResponse(0.001, true);
% if response
% fprintf('%i', response);
% a = 0;
% end
% end
% end
case 'Dummy'
%Set WD
cd '/home_local/meduser/Desktop/data/users/inghui/MRI Script 2015-01-28/';
%Set trigger
scannertrigger = 97;
%Set output/input comports
bitsiboxScanner = Bitsi('/dev/ttyS2');
bitsiboxButtons = Bitsi('');
bitsiEye = Bitsi('/dev/ttyS1');
% Right hand -- button down
ButtonA = 11; % left
ButtonB = 12; % right
ButtonC = 13; % confirm
ButtonD = KbName('a'); % pauze
ButtonE = KbName('b'); % next
ButtonF = KbName('Escape'); % close
ButtonG = KbName('space');
case {'Debugging', 'Keyboard'}
%Set WD
%cd 'C:\Users\claciv\Desktop\JGame_SPTP';
%cd 'M:\PhD_Donders_2015\projects\Justice Game';
wd = 'C:\Users\meduser\Desktop\experiment_MRI';
cd(wd)
%Set trigger
scannertrigger = KbName('a'); %key "a"
%Set comports to KB
bitsiboxScanner = Bitsi('');
bitsiboxButtons = Bitsi('');
bitsiEye = Bitsi('');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Note: Edit any of letters below, to use the ones you want
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ButtonA = KbName('leftarrow'); % left
ButtonB = KbName('downarrow'); % right
ButtonC = KbName('rightarrow'); % confirm & middle
ButtonD = KbName('space'); % spacebar, continue after break
ButtonF = KbName('Escape'); % close
case 'buttonbox'
scannertrigger = KbName('a');
bitsiboxScanner = Bitsi('');
bitsiboxButtons = Bitsi('COM1');
% Right hand -- button down
ButtonA = 97; % index finger
ButtonB = 98; % middle finger
ButtonC = 99; % ring finger
ButtonD = 100; % pinky finger
ButtonA_up = 65;
ButtonB_up = 66;
ButtonC_up = 67;
ButtonD_up = 68;
otherwise
disp('Missing proper value for "SCANNER" variable. Cannot set up Bitsi-boxes properly..');
end