go_away

Author Topic: Bluetooth Communication  (Read 2020 times)

0 Members and 1 Guest are viewing this topic.

Offline KanwalTopic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
  • RiSinG
Bluetooth Communication
« 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.

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,430
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
Re: Bluetooth Communication
« Reply #1 on: December 03, 2008, 12:32:26 AM »
post code, post makes and models of your BT device, give us some info on your PC/mac, fill us in a little more.

Offline KanwalTopic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
  • RiSinG
Re: Bluetooth Communication
« Reply #2 on: December 03, 2008, 01:54:27 AM »
%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.

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,430
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
Re: Bluetooth Communication
« Reply #3 on: December 03, 2008, 11:19:48 AM »
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..

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,657
  • Helpful? 169
    • Society of Robots
Re: Bluetooth Communication
« Reply #4 on: December 04, 2008, 09:48:14 PM »
Quote
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:
Quote
%Close Bluetooth connection.
COM_CloseNXT(handle);

 


Get Your Ad Here