From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Pairing Wii Remote "Wiimote" (or any bluetooth device) programmatically using a managed .net library in LabVIEW

Code and Documents

Attachment

Download All

image.JPG

Introduction

There is a fantastic resource for accessing Wii Remotes and getting data from them here however this code requires you to use Windows to pair the Wii Remotes before you can run the VI and this prompted me to find a way of doing this also from LabVIEW.

32feet.NET from In The Hand is a great library for programmatically pairing Bluetooth devices and accessing services on that device. Using this library in LabVIEW allowed me to create an all-in-one solution for pairing and accessing Wii Remotes.

Front Panel

frontpanel.PNG

Attachments

I have attached the LabVIEW 2009 VI as well as the latest (as of 24th Feb 2010) version of the Managed Library. To use the VI, press 1 + 2 on the Wii Remotes to make the LEDs flash then run the VI.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
ssingh1
Member
Member
on

Nice One, thanks. 🙂

Ashish_Naik_NIUK
NI Employee (retired)
on

Looking forward to getting some good use out of this!

Ashish Naik
Automotive Business Development Manager
National Instruments UK
paljacob
Member
Member
on

Superb! It works great, thanks!

Is it possible to make a subBluetoothDisconnect.vi?

Mark_SAI
Active Participant
Active Participant
on

Hi, I have actually made a very comprehensive set of VIs for the wiimote but they aren't ready to be released yet. In the meantime, I have a tip for you on how to disconnect the wiimotes after program execution:

- Place a .net reference on your front panel. Navigate to InTheHand.Net.Bluetooth.BluetoothSecurity, to create a Bluetooth Security reference.

- One of the methods (invoke node) of this is RemoveDevice.

- All you need to do is pass in the DeviceAddress (from the DeviceAddress property of a BluetoothDeviceInfo node)

~Chris.
Member
Member
on

Hey this is excellent! 

I was wondering if anyone has had success using this VI to connect a wii balance board?

If I understand correctly, the balance board uses the same bluetooth protocol as the wiimote, so I would expect it to work (but it doesn't).

I'm trying to connect under windows 7 32bit but the device driver fails to install.

Has anyone tried this?

Thanks.

Ruff
Member
Member
on

Thanks so much for your effort.

This will be so helpful in my further endeavors in my wiimote robotcs project for class.

ThiCop
Trusted Enthusiast
Trusted Enthusiast
on

Hello macaba,

Based on your code I have created a very basic class-based API that implements some of the functionality you've used here.

I abstracted your code to a set of higher-level "easy-to use" VIs:

https://decibel.ni.com/content/docs/DOC-31353

Please note that I have fully credited your example as inspiration.

Regards,

Thierry

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
rfandrade
Member
Member
on

I've tryied to call the dll using the "Call Library" function, but it appears the next message: "The library selected is not valid for the current platform. For example, you are running 64-bit LabVIEW and the library might be a 32-bit library".

This dll doesn't work for 64-bit platforms?

ThiCop
Trusted Enthusiast
Trusted Enthusiast
on

As far as I know the dll posted above is a 32-bit DLL (from the external 32Feet library), so you cannot directly call it from LabVIEW 64-bit.
More information about why it's not possible can be found over here:
http://digital.ni.com/public.nsf/allkb/6059E812DFC60ED486257640007B5DAF

Is there a specific reason why you need to use LabVIEW (64-bit) instead of LabVIEW (32-bit)?

Regards,

Thierry

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
Mark_SAI
Active Participant
Active Participant
on

Grab the latest version of the DLL from the developer's site, this should work for 64-bit. You may need to tweak the LabVIEW code as it is likely the DLL methods may have changed (this example was released 3.5 years ago!), Thierry could probably tell you if this is the case (assuming he got the latest DLL in his example code).

Albert.lu
Member
Member
on

Hello,

I used your program,and when pairing,windows 7 will appear below windows,is there any way to disable this,or progammaticly click next button?tks

request window.PNG

ganquetil
Member
Member
on

Hello ,

Thank you for your works, but I didn't find the attachment, where is it ?

 

Contributors