function MoBi_instructions(contraction_task, data_subject, volume, forces, bl) %% the function shows on the screen the stimulation parameters that have to be set cd 'C:\Users\neuro\Desktop\script_mobi_da_commentare' sca; close all; %% Do you want to tinker with small screen? (0 == no) tinker = 0; %% SCREEN SETTING [window, misure_schermo, screenNum, CenterX, CenterY, ifi] = MoBi_Screen_Settings_Brescia(tinker) % screen proportions proporzioni_schermo = misure_schermo(4)/misure_schermo(3); %% set the bus for MATLAB-arduino communication delete(instrfindall); clear s %Set up the serial port s = serial('COM5'); set(s, 'BaudRate', 115200); % set BaudRate to 115200 (as in Arduino!!!!!) % open it fopen(s); WaitSecs(2); for d = 1:2 MoBi_scrittura(s); end %% transform nominal delays (the ideal delay that one wants wait before a screen flip) into actual delays... %...(slightly smaller delays compared to the nominal ones so that Psychtoolbox flips the screen at the nominal time, see Peter Scarfe website on Psychtoolbox) % and see the explanation within the function [ifi_af... ifi_as... ifi_nf... ifi_ns] = MoBI_frames_Brescia(ifi, ifi); [onesec_af... onesec_as... onesec_nf... onesec_ns] = MoBI_frames_Brescia(1, ifi); %% we also have a black background. Bk.color = [0 0 0]; Bk.dimension = misure_schermo; %% INSTRUCTIONS FOR the researcher Screen('FillRect', window, Bk.color, Bk.dimension); Screen('TextSize', window, 25); % text position on the screen hor_alignement = round(misure_schermo(3)*0.5,0); ver_alignement = round(misure_schermo(4)*0.25,0); TMS_cond = contraction_task{1,1}; DrawFormattedText(window,TMS_cond, hor_alignement,... ver_alignement, [1 1 1]); clear hor_alignement ver_alignement testo_sx = contraction_task{1,2}; hor_alignement = round(misure_schermo(3)*0.25,0); ver_alignement = round(misure_schermo(4)*0.75,0); DrawFormattedText(window,testo_sx, hor_alignement,... ver_alignement, [1 1 1]); clear hor_alignement ver_alignement testo_dx = contraction_task{1,3} hor_alignement = round(misure_schermo(3)*0.75,0); ver_alignement = round(misure_schermo(4)*0.75,0); DrawFormattedText(window,testo_dx, hor_alignement,... ver_alignement, [1 1 1]); clear hor_alignement ver_alignement [VBL]=Screen(window, 'Flip', ifi, 1); % wait for keyboard press WaitSecs(2) %% wait for keyboard button press while ~KbCheck end end