Thursday, November 13, 2008

SunSpots + Lejos

Recently, I have been working on trying to get Lejos (Java For Lego) on Mac.
And I got no where. Lejos do not have mac universal install package so had to swith to windows.
It took me few about an hour to install lejos and eclipse. However eclipse did not do a great job setting Lejos up as an update. So I went back to the basic of uploading my program to NXT via bluetooth on terminal.

Lejos tutorial is good interms of explaining how to use the api's however they dont tell you anything about which libs you need to set up to get the bluetooth working or maybe I just missed
it.

First of you need to set you bluetooth with windows. You need to go to control panel and search for NXT bluetooth. NXT's bluetooth should be on and visible. After it is detected you need to choose the read pass from documentation box and type the passphrase which is 1234.
This should enable the bluetooth connection. Now you can upload your apps via bluetooth rather than USB.

But not yet there:

If you are writing a host application which communicates with the NXT via BlueTooth, there are few things that one has to pay attention to: first of all unlike a regular NXT app you should not use the classes.jar that comes with Lejos. The classes.jar should only be used for apps that runs on NXT. Second you need to add the bluecove.jar file which is in lejos 3rdparty folder.
If all goes well. Bluetooth should work



Lejos did a great job of abstracting the bluetooth stack from the user. All you need to do is to
NXTCommFactory class to create connections. The details are in the Documentation.

0 comments: