Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: Kanwal on December 02, 2008, 11:25:48 PM
-
Hi,
I am doing Bachelors in Telecommunication Engineering. I had chosen the field of robotics for my final year project, two more students are working with me.
Hardware is already there, means we are using LEGO Mindstorms NXT, and we are using MATLAB, the thing that we have to perform is to communicate two NXTs via bluetooth, for this purpose first we are connecting one NXT with PC via bluetooth, but there is a problem that it remains connected only for once and after that it start giving error, the error that is given below:
Warning: The specified amount of data was not returned within the Timeout period.
??? Error using ==> COM_OpenNXTEx>BT_OpenHandle
*** Bluetooth connection not working ***.
Please make sure that the NXT is turned on and your bluetooth adapter is connected.
Error in ==> COM_OpenNXTEx at 226
h = BT_OpenHandle(h, varargin{1}, varargin{2:end});
Error in ==> COM_OpenNXT at 76
handle = COM_OpenNXTEx('Any', '', varargin{:});
Error in ==> drive_around_wall at 6
handle = COM_OpenNXT('bluetooth.ini', 'check');
please help us because our semester is just to an end but the bluetooth issue is not solving at all.
-
post code, post makes and models of your BT device, give us some info on your PC/mac, fill us in a little more.
-
%Example 1: Play Tone and Get Battery Level
%Example to play a specific tone with the NXT Brick and retrieve the current
%battery level:
clear all
close all
% Open new NXT connection according to the previous generated configuration %file.
handle = COM_OpenNXT('bluetooth.ini', 'check');
COM_SetDefaultNXT(handle);
%Play tone with frequency 800Hz and duration of 500ms.
NXT_PlayTone(800,500);
%Get current battery level.
voltage = NXT_GetBatteryLevel
%Close Bluetooth connection.
COM_CloseNXT(handle);
MATLAB Toolbox: RWTHMindstormsNXTv2.00
System Requirements:
Operating system: Windows or Linux
MATLAB Version 7.3 (R2006b) or higher
LEGO® Mindstorms NXT building kit (e.g. Education Kit)
LEGO® Mindstorms NXT firmware v1.05 (recommended)
Bluetooth 2.0 adapter recommended model by LEGO® (e.g. AVM BlueFRITZ! USB) supporting the serial port profile (SPP)
The above requirements are mentioned in MATLAB Toolbox.
System on which we are doing our tasks is Windows XP and we are using WIDCOMM Bluetooth Software.
-
I'm not familiar with your coding language, but the most problems with bluetooth are, drivers installed properly, everything configured to be the same baud, etc..
-
but there is a problem that it remains connected only for once and after that it start giving error
Turn it on, but don't program it for about ~10 minutes. Then program it and see if it still works - there might be an auto-timeout feature?
Also, try removing this line of code and see what happens:
%Close Bluetooth connection.
COM_CloseNXT(handle);