-
Notifications
You must be signed in to change notification settings - Fork 9
/
EXAMPLE_PTB.m
50 lines (38 loc) · 1.22 KB
/
EXAMPLE_PTB.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
% EyeTribe Toolbox for Matlab testing script
%
% author: Edwin Dalmaijer
% email: [email protected]
%
% version 1 (16-Sep-2014)
% don't bother with vsync tests for this demo
Screen('Preference', 'SkipSyncTests', 1);
% initialize connection
[success, connection] = eyetribe_init('test');
% open a new window
window = Screen('OpenWindow', 2);
% calibrate the tracker
success = eyetribe_calibrate(connection, window);
% show blank window
Screen('Flip', window);
% start recording
success = eyetribe_start_recording(connection);
% log something
success = eyetribe_log(connection, 'TEST_START');
% get a few samples
% NOTE: this is NOT necessary for data recording and
% collection, but just a demonstration of the sample
% and pupil_size functions!
for i = 1:60
pause(0.0334)
[succes, x, y] = eyetribe_sample(connection);
[succes, size] = eyetribe_pupil_size(connection);
disp(['x=' num2str(x) ', y=' num2str(y) ', s=' num2str(size)])
end
% log something
success = eyetribe_log(connection, 'TEST_STOP');
% stop recording
success = eyetribe_stop_recording(connection);
% close connection
success = eyetribe_close(connection);
% close window
Screen('Close', window);