1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- function TMS4Threshold_MoBi()
- %% this function allows one researcher to deliver a TMS pulse by pressing a key
- tinker = 0;
- %% set the parallel port communication (it requires io64 .mex files)
- ioObj = io64;
- status = io64(ioObj);
- % specify address where one wants to send triggers
- address = hex2dec('DFB8');
- io64(ioObj, address, 0);
- %% set the screen with a fixation cross in the center
- [window, screen_dimensions, screenNum, CenterX, CenterY, ifi] = MoBi_Screen_Settings_Brescia(tinker);
- screen_dimensions_ratio = screen_dimensions(4)/screen_dimensions(3);
- Screen('FillRect', window, [0 0 0], screen_dimensions);
- Screen('TextSize', window, 80);
- DrawFormattedText(window, '+', 'center',...
- 'center', [1 1 1]);
- Screen(window, 'Flip');
- % assuming less than 1000 pulses...
- for i = 1:1000
-
- % stroke a key
- [secs, keyCode] = KbStrokeWait;
-
- % check which key has been stroked
- key = sum(find(keyCode));
-
-
- switch key
- case 27 % Esc
- sca
- break
- case (17+163) % Ctrl
-
- % switch all the pins on (send trigger to TMS)
- io64(ioObj, address, 255);
-
- i
-
- WaitSecs(0.005);
- % switch the pin off
- io64(ioObj, address, 0);
-
-
-
- otherwise
- continue
- end
-
- end
- end
|