资源简介

源代码;利用MATLAB串口,获取neurosky的专注度数据(也可用于TGAM、Brainlink、Mindwave等设备)

资源截图

代码片段和文件信息

function CallBackCom(objevent)
%CallBackCom 串口回调函数
%
global neurosky_scom
global buffer_attention_data
global attention_data
% try
neurosky_data = fread(neurosky_scom288‘uint8‘);

for i = 1:length(neurosky_data)-32
    if neurosky_data(i) == hex2dec(‘AA‘)
        if neurosky_data(i+1) == hex2dec(‘AA‘)
            if neurosky_data(i+2) == hex2dec(‘20‘)
                if neurosky_data(i+3) == hex2dec(‘02‘)
                    if neurosky_data(i+5) == hex2dec(‘83‘)
                        if neurosky_data(i+6) == hex2dec(‘18‘)
                            if neurosky_data(i+31) == hex2dec(‘04‘)
                                attention_data = neurosky_data(i+32);  %%专注度数值
                                buffer_attention_data = [buffer_attention_data(2:end); attention_data];
                                disp(attention_data);
                                break;
                            end
                        end
                    end
                end
            end
        end
    end
end
% catch
%     CloseNeuroskyCom;
% end

end


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        1112  2018-04-17 17:06  CallBackNeuroskyCom.m
     文件         134  2018-04-17 16:24  CloseNeuroskyCom.m
     文件         826  2018-08-05 15:25  GetNeuroskyData.m

评论

共有 条评论