Skip to content

Commit 2132ca7

Browse files
committed
update readme on how to set up keyboards
1 parent 9e3ebf9 commit 2132ca7

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,30 @@ You can then use the [matlab package manager](https://github.com/mobeets/mpm), t
7070
end
7171
```
7272

73+
## Setting up keyboards
74+
75+
To select a specific keyboard to be used by the experimenter or the participant, you need to know
76+
the value assigned by PTB to each keyboard device.
77+
78+
To know this copy-paste this on the command window:
79+
80+
``` matlab
81+
[keyboardNumbers, keyboardNames] = GetKeyboardIndices;
82+
83+
disp(keyboardNumbers);
84+
disp(keyboardNames);
85+
```
86+
87+
You can then assign a specific device number to the main keyboard or the response box in the `cfg` structure
88+
89+
- `cfg.keyboard.responseBox` would be the device number of the device used by the participant to give his/her
90+
response: like the button box in the scanner or a separate keyboard for a behavioral experiment
91+
- `cfg.keyboard.keyboard` would be the device number of the keyboard on which the experimenter will type or
92+
press the keys necessary to start or abort the experiment.
93+
94+
`cfg.keyboard.responseBox` and `cfg.keyboard.keyboard` can be different or the same.
95+
96+
Using empty vectors (ie `[]`) or a negative value for those means that you will let PTB find and use the default device.
7397

7498
## Structure and function details
7599

0 commit comments

Comments
 (0)