Multiple Keypress with FORP?

Hello all,

I am using Matlab 7.8.0 and PTB-3 on a win 64-bit operating system.
I am trying to record various keypresses simultaneously with a Fiber Optic Response Pad (FORP) and I can't seem to make it work!!:/ I am using a current design FORP model : FIU-004EU. The weird thing is that it works perfectly with a simple keypress but once I have to record two keypresses simultaneously it doesn't work. If I use the keyboard instead of the FORP it works fine. I don't understand why it does not work with the FORP since it is suppose to function as a keyboard... Thus I don't know if my script is incorrect or FORP can only send one signal at a time?

This is what I wrote (I am no programmer so please be gentle :)):

%Initialization
clear all %delete all pre-existing variables
close all %close all pre-opened windows

%Opening PTB
Screen('Preference', 'Verbosity', 2)
Screen('Preference', 'SkipSyncTests', 1)
[w, wrect]=Screen('OpenWindow', 0);
HideCursor;
[width, height] = Screen('WindowSize', w);


%Bienvenue
Screen(w, 'TextFont', 'Arial')
Screen(w, 'TextSize', 15)
Screen(w, 'TextStyle', 1)
DrawFormattedText(w, 'Bienvenue', 'center', 'center', [0 0 0]);
DrawFormattedText(w, 'Appuyez sur une touche pour commencer l´expérience...', 'center' , round(height/1.7), [0 0 0]);
Screen(w, 'Flip')

KbName('UnifyKeyNames')
kc_gauche = KbName('1!');
kc_droite = KbName('6^');
while 1

[keyIsDown, secs, keyCode, deltaSecs] = KbCheck(-1);


% Check that pressed keycodes and the desired codes overlap
% If so, then exit loop
if keyCode(kc_gauche) && keyCode(kc_droite)
disp('ok');
break
end
end


ShowCursor;

%Closing PTB
Screen('CloseAll');

If you have any suggestion I would really much appreciate them!

Thanks,

Cristian Buc Calderon
I am not 100% sure, but fORP seems to give very brief key down time. This means, even if the key is still pressed, it reports to system that the key is released after a brief time. For this reason, KbCheck often misses the key events. They have something called NAR mode to disable this feature, but I did not have luck to make it work.

There are several possible solutions. We used KbCheck and GetChar together, so we won't miss any key event. This works fine, but the timing by GetChar is not good, as stated in PTB documentation.

The second solution is to use KbQueue series functions to replace KbCheck. This should work, but I did not test it due to the following reason. KbQueue series functions are powerful, but the syntax is a little inconvenient. I have a code like a wrapper for it. It you like to try it, send me an email.

The third solution is to use fOPR's serial output. I never tried it. The con for this approach is that, it makes the code test on other computers inconvenient.

The fourth solution, which we are using now, is to use fOPR's TTL output to drive another USB keyboard device. This is the reason I did not test KbQueue with fORP's USB output, because we are not using it at all :) The USB keyboard device may sound complicated, but I have a simple and inexpensive device for this purpuse. I still adopt the way by fOPR to fake key release, but with a longer key down duration, so the system won't miss any events. The TTL/serial port output connector for new fOPR unit is not cheap though :)

For your purpose, I think the first thing to try is to use KbQueue solution. Sorry for the long post.

-Xiangrui


--- In psychtoolbox@yahoogroups.com, "buccalderon.cristian" <buccalderon.cristian@...> wrote:
>
> Hello all,
>
> I am using Matlab 7.8.0 and PTB-3 on a win 64-bit operating system.
> I am trying to record various keypresses simultaneously with a Fiber Optic Response Pad (FORP) and I can't seem to make it work!!:/ I am using a current design FORP model : FIU-004EU. The weird thing is that it works perfectly with a simple keypress but once I have to record two keypresses simultaneously it doesn't work. If I use the keyboard instead of the FORP it works fine. I don't understand why it does not work with the FORP since it is suppose to function as a keyboard... Thus I don't know if my script is incorrect or FORP can only send one signal at a time?
>
> This is what I wrote (I am no programmer so please be gentle :)):
>
> %Initialization
> clear all %delete all pre-existing variables
> close all %close all pre-opened windows
>
> %Opening PTB
> Screen('Preference', 'Verbosity', 2)
> Screen('Preference', 'SkipSyncTests', 1)
> [w, wrect]=Screen('OpenWindow', 0);
> HideCursor;
> [width, height] = Screen('WindowSize', w);
>
>
> %Bienvenue
> Screen(w, 'TextFont', 'Arial')
> Screen(w, 'TextSize', 15)
> Screen(w, 'TextStyle', 1)
> DrawFormattedText(w, 'Bienvenue', 'center', 'center', [0 0 0]);
> DrawFormattedText(w, 'Appuyez sur une touche pour commencer l´expérience...', 'center' , round(height/1.7), [0 0 0]);
> Screen(w, 'Flip')
>
> KbName('UnifyKeyNames')
> kc_gauche = KbName('1!');
> kc_droite = KbName('6^');
> while 1
>
> [keyIsDown, secs, keyCode, deltaSecs] = KbCheck(-1);
>
>
> % Check that pressed keycodes and the desired codes overlap
> % If so, then exit loop
> if keyCode(kc_gauche) && keyCode(kc_droite)
> disp('ok');
> break
> end
> end
>
>
> ShowCursor;
>
> %Closing PTB
> Screen('CloseAll');
>
> If you have any suggestion I would really much appreciate them!
>
> Thanks,
>
> Cristian Buc Calderon
>