LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending/Receiving Numerical Values Over Bluetooth

LabVIEW 2009 STUDENT EDITION W/NXT TOOLKIT. I am a beginner when it comes to LabVIEW. I am working on a school project with the humanoid detecting colored marbles. I set 4 buttons for blue, green, red, and yellow on the front panel. These Boolean values would be compared to values from the color sensor on the Mindstorms 2.0 kit and send numeric values 2-5 to the NXT brick. The NXT brick would read the number and apply the number to a case. The humanoid would ask for the color selected on the front panel. A goal is to send the color detected to an indicator on the front panel. My immediate problem is after 7 hours of searching the internet and trying every vi in the toolkit, I cannot send or receive from the PC or NXT. I only have (1)NXT. Anyone with explicit instructions? Please?
0 Kudos
Message 1 of 6
(7,616 Views)

I have a couple questions for you.  First, are you using a desktop computer or laptop computer?  Is your computer a Mac or Windows?  Is your computer equipped with bluetooth internally, or are you plugging in an adapter? 

 

It is very simple to connect to a NXT using bluetooth, and once that connection is established, you can easily transfer data.  The code below will show a very simple example of doing what I think you are asking.

 

NXT.png

National Instruments
Applications Engineer
0 Kudos
Message 2 of 6
(7,606 Views)

I am a Windows 7 laptop user. I am using an external Iomega bluetooth adapter that has worked fine for downloading programs to execute. Approximately 17 hours into this problem alone I found a download showing an orange vi that was loading from an NXT\Remote... folder. To complicate things I did a firmware update that erased NXTSHELL. With NXTSHELL reloaded and using the new vi, it is working. The problem now is the vi only sends text. I need to convert the boolean front panel button to either the number representing the color or the name of the color so that it asks the robot to detect blue/2, green/3, yellow/4, red/5. I need the reading vi on the NXT brick to send a True/False and the number or color name too. The included picture is a last ditch effort to get something working at 2:30a in the morning to build on today. I was barely awake. This is rigged to look like it does what it is supposed to do but is not what is intended, as stated above. Please correct or point me in the right direction.

Closer

0 Kudos
Message 3 of 6
(7,602 Views)

The code below is all you need to do to get the device communicating with your laptop.  I pulled out a NXT module and checked it and it works great.  The code on the left is what you deploy to the NXT brick.  The code on the right is what you run on your computer.  If you should see the indicator change values as the detected color changes values.

 

NXT.png
National Instruments
Applications Engineer
0 Kudos
Message 4 of 6
(7,587 Views)

Scott,

 

YOU ROCK!!! That is a very explicit yet concise way to offer support and an explanation. I have no tried communicating from the brick to the laptop. Does this mean I cannot communicate from the front panel on my laptop to tell the NXT for which color value case to ask?Closer2

0 Kudos
Message 5 of 6
(7,585 Views)

You can always send data back and forth between the computer and the NXT brick.  Instead of using booleans, you may want to look into a text ring control.  This allows you to hav a number associated with a text value.  In this case I have Blue = 2 and so forth.

colors.png

 

Then you can just simply send to client and read teh box of the NXT to get the data back.  For example, the code below will play a different sound depending on which color you choose.

NXT.png

Message Edited by Scott W on 05-05-2010 11:12 AM
National Instruments
Applications Engineer
0 Kudos
Message 6 of 6
(7,576 Views)