Bluetooth Connection

Post your NXJ projects, project ideas, etc here!

Moderators: 99jonathan, roger, imaqine

Bluetooth Connection

Postby cyborg171 » Sun May 01, 2011 8:41 am

Hi,

I am working with Lego Mindstorm NXT kit to make a robotic car with a webcam attached to it. The car uses an ultrasonic sensor for obstacle avoidance and the webcam for color detection. The webcam detects color red and green where red represents an obstacle and green represents its destination. The car has to find its destination and move towards it while avoiding obstacles in its way.

I have the program for color detection ready, but I cannot understand how to get the NXT brick connected with the laptop through bluetooth and how to develop the program that can send commands via bluetooth to the brick to move in a set direction. The camera takes images and tries to find out its way.

Please help.

Thanks.

Jiten Sheth
Last edited by cyborg171 on Sun May 01, 2011 8:45 am, edited 1 time in total.
cyborg171
New User
 
Posts: 1
Joined: Sun May 01, 2011 8:34 am

Re: Bluetooth Connection

Postby gloomyandy » Sun May 01, 2011 8:44 am

Look at the pcsamples and the samples. There are examples of how to create a Bluetooth connection on the PC and how to listen for a connection on the NXT.

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3881
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Bluetooth Connection

Postby shamyl » Tue May 10, 2011 3:23 pm

Hi,
We have been trying to do the same thing. We are able to run the PC sample program given with lejos to send data to NXT and we are successful. The only problem is we don't want to send our bluetooth data from any program in java. We want to send this using hyper terminal on Windows XP. Here is what we do

We first pair our NXT with our PC.
We have written a sample program that receives bluetooth data from the PC (this works fine with the pcsample provided with Lejos).
We then open hyper terminal and connect to the NXT which is successful.
Problem comes when we send a single character to the NXT and nothing happens!

So is there any special way that the function dos.writeChars() uses to send characters to NXT. I mean does it do any encapsulation??? Since we have tried to send the same character via Hyper Terminal and it doesn't work.

Please help...

Shamyl
shamyl
New User
 
Posts: 3
Joined: Tue May 10, 2011 3:13 pm

Re: Bluetooth Connection

Postby lawrie » Wed May 11, 2011 8:54 pm

Have you opened the connection in RAW mode on the NXT?
lawrie
leJOS Team Member
 
Posts: 909
Joined: Mon Feb 05, 2007 1:27 pm

Re: Bluetooth Connection

Postby shamyl » Fri May 13, 2011 11:10 am

lawrie wrote:Have you opened the connection in RAW mode on the NXT?


Can you tell me what exactly does raw mode mean? If i go to the bluetooth menu in LeJos in my mindstorm I have options to turn Bluetooth on, visibility on, search and pair, devices and change PIN.

Is there any other mode that selects raw mode that I'm missing here?

Best,
Shamyl
shamyl
New User
 
Posts: 3
Joined: Tue May 10, 2011 3:13 pm

Re: Bluetooth Connection

Postby shamyl » Fri May 13, 2011 11:11 am

susanexpress wrote:Hello, I met the same problem before. But now it is solved by one of my friends.


How? Can you please share...

Shamyl
shamyl
New User
 
Posts: 3
Joined: Tue May 10, 2011 3:13 pm

Re: Bluetooth Connection

Postby gloomyandy » Fri May 13, 2011 1:41 pm

To use raw mode you specify it when you open the connection, either through the WaitForConnect or Connect methods, see:
http://lejos.sourceforge.net/nxt/nxj/ap ... ,%20int%29
http://lejos.sourceforge.net/nxt/nxj/ap ... ,%20int%29

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3881
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK


Return to NXJ Projects

Who is online

Users browsing this forum: No registered users and 0 guests

more stuff