I am trying to build a BCI which will communicate with an arduino card (MKR1000). I want to send stimulation from openVibe to Arduino using the Matlab box but I get this error when I try to run a simple test program :
---- MATLAB BUFFER - ERROR ! ----
Error in send_triggeriProcess (line 6)
p=readDigitalPin(a,'D6');
I use MATLAB R2019b with the following functions :
Initialize function
Code: Select all
function box_out = send_trigger_Init(box_in)
clear all
disp('Matlab initialize function has been called.')
% we add a field to save the trigger state
box_in.user_data.trigger_state = false;
% Don't forget to pass the modified box as output.
box_out = box_in;
clc
if ~isempty(instrfind)
fclose(instrfind);
delete(instrfind);
end
global a;
a= arduino('COM7','MKR1000');
end
Process function
Code: Select all
function box_out = send_trigger_Process(box_in)
% we iterate over the pending chunks on input 1 (STIMULATIONS)
for i = 1: OV_getNbPendingInputChunk(box_in,1)
p=readDigitalPin(a,'D6');
fprintf('LED = %f\n', p)
end
% Pass the modified box as output to continue processing
box_out = box_in;
end
Every suggestion can be helpfull
Thank you