Problem start making leJOS programs

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

Problem start making leJOS programs

Postby quack » Wed Jul 11, 2007 10:58 am

Could anyone explain me how do I start making leJOS programs to my NXT? I don't even know which program to use to write the code and how to transfer it to my NXT (there is no drive related to NXT in My Computer)...

(sorry for my english, i'm portuguese)
quack
Novice
 
Posts: 26
Joined: Sun Jul 08, 2007 9:03 pm

Postby 99jonathan » Wed Jul 11, 2007 2:21 pm

Hello!! Welcome to the forums!

First, download and install:
http://libusb-win32.sourceforge.net/#downloads

If you don't have the lego nxt software installed, do so.

Next, set the environment variable LEJOS_HOME to the full path of the lejos_nxj directory.

Add the lejos_nxj/bin directory to your PATH.

Here is a sample program to test:
Open a command window
Check that java and lejos are on your PATH
Change to the lejos samples\Tune directory
Type lejosjc Tune.java
Type lejoslink Tune -o Tune.bin
Check that your USB cable is connected
Press the orange button to turn on the NXT
Check that the NXT is in firmware update mode. Put it in it by pressing the reset button for more than 4 secs. The screen should be blank and the NXT should be audibly clicking.
Type lejosdl Tune.bin
A tune should play


When you use lejosdl your program will download and run. You can stop a program by pressing the ENTER and ESCAPE (orange and grey square) buttons together. This powers down the NXT immediately. Press the ENTER (orange) button to wake it up again.

You can also power down the NXT with ENTER + ESCAPE, after an Exception occurs.

You can program in a simple text editor like notepad and save as .java or you could use such editors as Eclipse. If you do use eclipse, the simplest way to set up lejos in it is to rightclick on your project and choose properties. Select "Java Build Path" and then Libraries. Click on the JRE library and press remove. "Add External JAR" and choose the classes.jar in your lejos directory/lib. That will get you started up!!

If you want some preliminary help with Java programming or beginning lejos, you can read this:
http://putstuff.putfile.com/93777/3790705
99jonathan
Moderator
 
Posts: 122
Joined: Thu Mar 01, 2007 5:30 am

Postby quack » Wed Jul 11, 2007 2:41 pm

Thanks a lot.
quack
Novice
 
Posts: 26
Joined: Sun Jul 08, 2007 9:03 pm

Postby quack » Wed Jul 11, 2007 3:31 pm

I have another question.

You talked about using eclipse. Is there a way (plugin maybe) that allow to compile and test with an emulator and then send it to the NXT?

Or I still have to do it with command line?
Last edited by quack on Wed Jul 11, 2007 5:55 pm, edited 1 time in total.
quack
Novice
 
Posts: 26
Joined: Sun Jul 08, 2007 9:03 pm

Postby boozer » Wed Jul 11, 2007 5:00 pm

check out www.eclipse.org for easy debug/compile/link/project management tools. No emulator that I know of though..
boozer
New User
 
Posts: 7
Joined: Mon May 21, 2007 3:28 am
Location: mass

Postby 99jonathan » Wed Jul 11, 2007 5:08 pm

The only current emulator is for Linux... :cry:
99jonathan
Moderator
 
Posts: 122
Joined: Thu Mar 01, 2007 5:30 am

Postby quack » Wed Jul 11, 2007 5:41 pm

so it's the same... i'll have to build the .bin file and send it to NXT always through command line no matter which text editor i use.. right?
quack
Novice
 
Posts: 26
Joined: Sun Jul 08, 2007 9:03 pm

Postby boozer » Wed Jul 11, 2007 6:59 pm

If you use eclipse: you can create an external program tool that runs the command lines in the console automatically at the press of a button or assignable quick-key.

The eclipse IDE integrates an editor, console, debugger, builder, package viewer, cvs, and project file management tools all on one interface. I highly recommend it.
boozer
New User
 
Posts: 7
Joined: Mon May 21, 2007 3:28 am
Location: mass

Postby 99jonathan » Thu Jul 12, 2007 2:15 am

Any instructions on how to set up such an external program?
99jonathan
Moderator
 
Posts: 122
Joined: Thu Mar 01, 2007 5:30 am

Postby quack » Thu Jul 12, 2007 1:58 pm

I would like those too..
quack
Novice
 
Posts: 26
Joined: Sun Jul 08, 2007 9:03 pm


Return to NXJ Software

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron
more stuff