tags:

views:

834

answers:

4

Hello all,

I'm trying to make my laptop communicate with a robot using bluetooth and with a user interface in C#. The information I need to send is very small and basic. It is a simple string and that is it.

I have not had any experience using bluetooth really, so the way i figure it for the laptop I could use the built-in bluetooth in my laptop as I know what COM port that is on. However, for the robot I purchased a separate bluetooth device (a USB dongle?). I've also downloaded and installed the Microsoft.WindowsMobile.SharedSource.Bluetooth. Now the problem I'm facing is that I don't know what to do with it. There is a BluetoothDevice class and a BluetoothRadio class. Which should I use? I paired the device to my laptop.

I have searched extensively online and just could not find anything simple enough. When I try to simplify the code myself it doesn't work. I just need to send one simple string from my laptop to the USB bluetooth device that will be attached to the robot.

I know there is a 32feet alternative to the microsoft namespace but i would prefer to use the microsoft one.

Any suggestions? I'd appreciate it immensely.

+1  A: 

Pairing the Robot with your laptop should present a COM port or similar from the robot. In this case you can treat Bluetooth as a transport protocol that facilitates your COM port.

ck
+2  A: 

You may want to look into the coding4fun library. It has a Bluetooth library which may help. Coding4Fun on Codeplex

Bivoauc
I tried this but unfortunately didn't work
Waleed Eissa
A: 

Try http://inthehand.com/content/32feet.aspx

SteveCav
+2  A: 

I'm maintainer of the 32feet.NET library. I don't know much about the Microsoft Shared Source Bluetooth library but think that there's no support nor maintainance ongoing with it. Our library is very widely used and well supported. :-)

Anyway, a simple connection could be done with code like the following:

Dim addr As BluetoothAddress _
  = BluetoothAddress.Parse("001122334455")
'
Dim ep As New BluetoothEndPoint(addr, BluetoothService.SerialPort)
Dim cli As New BluetoothClient
cli.Connect(ep)
Dim peerStream As Stream = cli.GetStream()
peerStream.Write/Read ...

See more at the User Guide at http://www.alanjmcf.me.uk/comms/bluetooth/32feet.NET%20--%20User%20Guide.html or in the release.

alanjmcf