With Bluetooth you don't need the USB wire anymore, the NXT is freed!
- Send a programm to the brick without cable connection.
- Or programming on your computer, using big memory and speed, sending the commands to the brick and receiving back the sensor values.
- be careful: setting registers in sensors is not possible, see master slave
Preliminaries:
- the hardware: buy a dongle (sitecom...)
- install bluetooth software, Bluesoleil, or Widcomm
- if all is in place (The sitecom dongle seems to have bluetooth all in itself, later i connected without widcomm nor bluesoleil)
- do a "search" of bluetooth devices
- find the brick and connect: pairing will be done (always use pin-key 1234 for both laptop and brick (in lejos only the PC askes for a code)
- a COMPORT number will be given
- when this is done you can connect (by hand", using the COMPORT (in leftclick on brick icon in BlueSoleil)
- the COMPORT number is something on the laptop, not on the brick (another laptop another COMPORT number)
- the connection can go two ways: from laptop or from brick: you need from laptop
- choose a programming environment, Dev Cpp, or C# (visual express)
- if JAVA is wanted, use icommand, but somehow, this is difficult to get working in ECLIPSE
- get some of the free libs, (I used Anders of Bram Fokke to start from, links see below)
- the the examples coming with these libs connect and deconnect themselves
- in case of programm stopping, look if Brick is deconnected to, sometimes need to restart brick and or dongle in and out of the laptop, to reset the bluetooth
- another possibility is the "fantom API" provided by LEGO itself. I found this link: http://epirsch.blogspot.com/2008/02/jna-love-nxt.html, built the packages in ECLIPSE (added a bit of exception classes) and it worked! For this only a dongle is needed, and the JAVA of course, including the jna.jar
The COMPORT number needs to be smaller then 10. If you encounter a number higher then 10, try troubleshooting
Other tips:
- don't confuse icommands and bluetooth! Bluetooth is in the standard lib of Lejos and others, icommand only for JAVA-fans who want to steer the NXT from for instance ECLIPSE using bluetooth.
- as told: bluetooth is one, but steering the NXT is another: you need a prog on the laptop to send and receive the DIRECT COMMANDS send through Bluetooth. This can be found in the libs of Bram Fokke, using Microsoft Visual C# (good introduction!) or the libs of Anders in Dev Cpp.
- bluesoleil is ok for C++ and C#, for icommand/ECLIPSE bluesoleil seems to block the connection (see below)
Free libs:
- Anders C++: http://www.norgesgade14.dk/bluetoothlibrary.php
- Bram Fokke C#: http://www.codeproject.com/useritems/nxtBluetooth.asp?df=100&forumid=420165&exp=0&select=2211060
- de Bluetooth Developer Kit: http://mindstorms.lego.com/Overview/NXTreme.aspx
- all the libs are based on DIRECT COMMANDS
Ok using these libs, and building on the examples the NXT is driving around, steered from the PC.
Further ideas: Steering from the web, or Second Life, using a server.
Bluetooth problem: (loading progs to the brick)
Later on with Bluesoleil installed i could not connect from the COMMANDWINDOW using lejos.
Although the brick was running (lejos) the brick was not found from the COMMANDWINDOW, i could connect manually using Bluesoleil
The solution was to desinstall Bluesoleil. This probably has to do with the dongel of sitecom i used.
In the COMMANDWINDOW i used this to check:
| C;\java\lejos_nxj\samples\tune> lejosdl -b tune Linking... Uploading... Bluecove version 2.0.0 on winsock Found 5brickXT Upload succesful in 2344 milliseconds Bluecove stack shutdown completed |
Also using the ECLIPSE utility for the lejos i could now browse the brick using bluetooth and run programs
From the console in ECLIPSE:
| Linking... Uploading... BlueCove version 2.0.0 on winsock Found: 5brickXTUpload successful in 5062 milliseconds BlueCove stack shutdown completed |
0 comments:
Post a Comment