Problem with the Thinkgear

6 Ansichten (letzte 30 Tage)
LAI Mom Cin
LAI Mom Cin am 5 Mai 2019
I'm using Matlab r2014a 64bits
think.PNG
Here is the code:
%Clear Screen
clc;
%Clear Variables
clear all;
%Close figures
close all;
%Preallocate buffer
data_med = zeros(1,256);
%Comport Selection
portnum1 = 4;
%COM Port #
comPortName1 = sprintf('\\\\.\\COM%d', portnum1);
% Baud rate for use with TG_Connect() and TG_SetBaudrate().
TG_BAUD_115200 = 115200;
% Data format for use with TG_Connect() and TG_SetDataFormat().
TG_STREAM_PACKETS = 0;
% Data type that can be requested from TG_GetValue().
TG_DATA_MEDITATION = 3;
%load thinkgear dll
loadlibrary('thinkgear64.dll');
%To display in Command Window
fprintf('thinkgear64.dll loaded\n');
%get dll version
dllVersion = calllib('Thinkgear', 'TG_GetDriverVersion');
%To display in command window
fprintf('ThinkGear DLL version: %d\n', dllVersion );
% Get a connection ID handle to ThinkGear
connectionId1 = calllib('Thinkgear', 'TG_GetNewConnectionId');
if ( connectionId1 < 0 )
error( sprintf( 'ERROR: TG_GetNewConnectionId() returned %d.\n', connectionId1 ) );
end;
% Attempt to connect the connection ID handle to serial port "COM3"
errCode = calllib('Thinkgear', 'TG_Connect', connectionId1,comPortName1,TG_BAUD_115200,TG_STREAM_PACKETS );
if ( errCode < 0 )
error( sprintf( 'ERROR: TG_Connect() returned %d.\n', errCode ) );
end
fprintf( 'Connected. Reading Packets...\n' );
i=0;
j=0;
%To display in Command Window
disp('Reading Brainwaves');
figure;
while i < 40
if (calllib('Thinkgear','TG_ReadPackets',connectionId1,1) == 1) %if a packet was read...
if (calllib('Thinkgear','TG_GetValueStatus',connectionId1,TG_DATA_MEDITATION ) ~= 0)
j = j + 1;
i = i + 1;
%Read attention Valus from thinkgear packets
data_med(j) = calllib('Thinkgear','TG_GetValue',connectionId1,TG_DATA_MEDITATION );
%To display in Command Window
disp(data_med(j));
%Plot Graph
plot(data_med);
title('Meditation');
%Delay to display graph
pause(1);
end
end
end
%To display in Command Window
disp('Loop Completed')
%Release the comm port
calllib('Thinkgear', 'TG_FreeConnection', connectionId1 );
Here is the error:
Error using loadlibrary>lFullPath (line 604)
Could not find file thinkgear64.h.
Error in loadlibrary (line 219)
header=lFullPath(header);
Error in example1 (line 20)
loadlibrary('thinkgear64.dll');
  1 Kommentar
Walter Roberson
Walter Roberson am 5 Mai 2019
Other people have had a bunch of trouble getting a 64 bit version of the thinkgear libraries.
In the time your MATLAB version was released, there was no 64 bit thinkgear library.
If I recall correctly when I looked a few months ago, thinkgear did finally list a 64 bit library, but the person was having difficulty getting it to work.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2014a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by