Additions:
[secs, keyCode, deltaSecs] = KbWait([deviceNumber][, forWhat=0][, untilTime=inf])
If the optional parameter 'untilTime' is provided, KbWait will only wait
until that time and then return regardless if anything happened on the
keyboard or not.
=== OSX and Linux ===
As a little bonus, KbWait can also query other HID human input devices
which have keys or buttons as if they were keyboards. If you pass in the
deviceIndex of a mouse (GetMouseIndices will provide with them), it will
treat mouse button state as keyboard state. Similar behaviour usually
works with Joysticks, Gamepads and other input controllers.
Deletions:
[secs, keyCode, deltaSecs] = KbWait([deviceNumber][, forWhat=0])
=== OSX ===
Additions:
"http://svn.berlios.de/svnroot/repos/osxptb/beta/Psychtoolbox/PsychBasic/KbWait.m">beta</a> | view WebSVN <a href=
"http://svn.berlios.de/wsvn/osxptb/trunk/Psychtoolbox/PsychBasic/KbWait.m?op=log">changelog</a> of trunk branch</span>
Deletions:
"http://svn.berlios.de/svnroot/repos/osxptb/beta/Psychtoolbox/PsychBasic/KbWait.m">beta</a> | view in <a href=
"http://svn.berlios.de/wsvn/osxptb/beta/Psychtoolbox/PsychBasic/KbWait.m?view=markup">WebSVN with changelog</a></span>
Additions:
"http://svn.berlios.de/wsvn/osxptb/beta/Psychtoolbox/PsychBasic/KbWait.m?view=markup">WebSVN with changelog</a></span>
Deletions:
"http://svn.berlios.de/viewcvs/osxptb/beta/Psychtoolbox/PsychBasic/KbWait.m?view=markup">WebSVN with changelog</a></span>
Additions:
keyboard devices will be checked. If deviceNumber is -2, all keypad
devices (if any) will be checked. If deviceNumber is -3, all keyboard and
keypad devices will be checked. The device numbers to be checked are
Deletions:
keyboard devices will be checked. The device numbers to be checked are
Additions:
around this problem. See also "help RestrictKeysForKbCheck".
Deletions:
around this problem.
Additions:
CAUTION: KbWait periodically checks the keyboard. After each failed check
(ie. no change in keyboard state) it will wait for 5 msecs before the
next check. This is done to reduce the load on your system, and it is
important to do so. However if you want to measure reaction times this is
clearly not what you want, as it adds up to 5 msecs extra uncertainty to
all measurements!
Additions:
""
<div class="code_header" style="text-align:right;">
<span style="float:left;">Path </span> <span class="counter">Retrieve current version of KbWait.m from berliOS: <a href=
"http://svn.berlios.de/svnroot/repos/osxptb/beta/Psychtoolbox/PsychBasic/KbWait.m">beta</a> | view in <a href=
"http://svn.berlios.de/viewcvs/osxptb/beta/Psychtoolbox/PsychBasic/KbWait.m?view=markup">WebSVN with changelog</a></span>
</div>
<div class="code">
<code>Psychtoolbox/PsychBasic/KbWait.m</code>
</div>
""
Deletions:
%%(php;Path)Psychtoolbox/PsychBasic/KbWait.m%%
Additions:
==[[Psychtoolbox]] › [[PsychBasic]]==
Deletions:
==[[Psychtoolbox]] › PsychBasic==
Additions:
%%(php;Path)Psychtoolbox/PsychBasic/KbWait.m%%
Deletions:
PsychBasic
Additions:
below.
Deletions:
below.++
Additions:
below.++
Deletions:
below.
Additions:
==[[Psychtoolbox]] › PsychBasic==
Deletions:
==Psychtoolbox › PsychBasic==
Additions:
==Psychtoolbox › PsychBasic==
Deletions:
==Psychtoolbox › PsychBasic › KbWait.m==
Additions:
==Psychtoolbox › PsychBasic › KbWait.m==
Deletions:
==PsychBasic==
Additions:
==PsychBasic==
=== OSX ===
----
Deletions:
==PtbReference › PsychBasic==
OSX: ___________________________________________________________________
_________________________________________________________________________
Additions:
==PtbReference › PsychBasic==
OSX: ___________________________________________________________________
_________________________________________________________________________
Deletions:
==PsychBasic==
""==""= OSX: ""==""=
""==""= ______________________________________________________________________ ""==""=
Edited on
2008-03-20 11:08:07 by
DocBot [Reverting last edit by DocBot [2630] to previous version [2629]]
Additions:
==PsychBasic==
""==""= OSX: ""==""=
""==""= ______________________________________________________________________ ""==""=
Deletions:
==PtbReference › PsychBasic==
OSX: ___________________________________________________________________
_________________________________________________________________________
Additions:
==PtbReference › PsychBasic==
OSX: ___________________________________________________________________
_________________________________________________________________________
Deletions:
==PsychBasic==
""==""= OSX: ""==""=
""==""= ______________________________________________________________________ ""==""=
""<div class="mergeconflict">""=== Merge Conflict on Thu Mar 20 11:04:32 2008 ===
%(diff)
---
+++
@@ -1,57 +1,54 @@
-===[[KbWait]]===
-==PtbReference › PsychBasic==
-
-[secs, keyCode, deltaSecs] = KbWait([deviceNumber][, forWhat=0])
-
-Waits until any key is down and optionally returns the time in seconds
-and the keyCode vector of keyboard states, just as KbCheck would do. Also
-allows to wait for release of all keys or for single keystrokes, see
-below.
-
-If you have trouble with KbWait always returning immediately, this could
-be due to "stuck keys". See "help DisableKeysForKbCheck" on how to work
-around this problem.
-
-GetChar and CharAvail are character oriented (and slow), whereas KbCheck
-and KbWait are keypress oriented (and fast).
-
-Using KbWait from the MATLAB command line: When you type "KbWait" at the
-prompt and hit the enter/return key to execute that command, then KbWait
-will detect the enter/return key press and return immediatly. If you
-want to test KbWait from the command line, then try this:
-
- WaitSecs(0.2);KbWait
-
-KbWait can also wait for releasing of keys instead of pressing of keys
-if you set the optional 2nd argument 'forWhat' to 1.
-
-If you want to wait for a single keystroke, set the 'forWhat' value to 2.
-KbWait will then first wait until all keys are released, then for the
-first keypress, then it will return. The above example could be realized
-via:
-
- KbWait([], 2);
-
-If you would set 'forWhat' to 3 then it would wait for releasing the key
-after pressing it againg, ie. waitForAllKeysReleased -> waitForKeypress
--> waitForAllKeysReleased -> Return [secs, keyCode] of the key press.
-
-
-OSX: ___________________________________________________________________
-
-KbWait uses the PsychHID function, a general purpose function for
-reading from the Human Interface Device (HID) class of USB devices.
-
-KbWait tests the first USB-HID keyboard device by default. Optionally
-you can pass in a 'deviceNumber' to test a different keyboard if multiple
-keyboards are connected to your machine. If deviceNumber is -1, all
-keyboard devices will be checked. The device numbers to be checked are
-determined only on the first call to the function. If these numbers
-change, the function can be reset using "clear KbWait".
-_________________________________________________________________________
-
-See also: KbCheck, KbStrokeWait, KbPressWait, KbReleaseWait, GetChar, CharAvail, KbDemo.
-
-
-
+===[[KbWait]]===
+==PsychBasic==
+
+[secs, keyCode, deltaSecs] = KbWait([deviceNumber][, forWhat=0])
+
+Waits until any key is down and optionally returns the time in seconds
+and the keyCode vector of keyboard states, just as KbCheck would do. Also
+allows to wait for release of all keys or for single keystrokes, see
+below.
+
+If you have trouble with KbWait always returning immediately, this could
+be due to "stuck keys". See "help DisableKeysForKbCheck" on how to work
+around this problem.
+
+GetChar and CharAvail are character oriented (and slow), whereas KbCheck
+and KbWait are keypress oriented (and fast).
+
+Using KbWait from the MATLAB command line: When you type "KbWait" at the
+prompt and hit the enter/return key to execute that command, then KbWait
+will detect the enter/return key press and return immediatly. If you
+want to test KbWait from the command line, then try this:
+
+ WaitSecs(0.2);KbWait
+
+KbWait can also wait for releasing of keys instead of pressing of keys
+if you set the optional 2nd argument 'forWhat' to 1.
+
+If you want to wait for a single keystroke, set the 'forWhat' value to 2.
+KbWait will then first wait until all keys are released, then for the
+first keypress, then it will return. The above example could be realized
+via:
+
+ KbWait([], 2);
+
+If you would set 'forWhat' to 3 then it would wait for releasing the key
+after pressing it againg, ie. waitForAllKeysReleased -> waitForKeypress
+-> waitForAllKeysReleased -> Return [secs, keyCode] of the key press.
+""==""= OSX: ""==""=
+
+KbWait uses the PsychHID function, a general purpose function for
+reading from the Human Interface Device (HID) class of USB devices.
+
+KbWait tests the first USB-HID keyboard device by default. Optionally
+you can pass in a 'deviceNumber' to test a different keyboard if multiple
+keyboards are connected to your machine. If deviceNumber is -1, all
+keyboard devices will be checked. The device numbers to be checked are
+determined only on the first call to the function. If these numbers
+change, the function can be reset using "clear KbWait".
+""==""= ______________________________________________________________________ ""==""=
+
+See also: KbCheck, KbStrokeWait, KbPressWait, KbReleaseWait, GetChar, CharAvail, KbDemo.
+
+
PsychBasic%%
""</div>""
Full history for this page cannot be displayed within a single page, click
here to view more.