Start of Tutorial > Start of Trail |
The following instructions, which refer to the Microsoft Windows
platforms (95/98/ME,NT,2000,XP), will help you to run your first leJOS
program.
We presume that you are familiar with the Java language on an
elementary level at least. If this is not the case, we encourage you to
consult the first trails of the The Java
Tutorial provided by Sun Microsystems.
Besides the LEGO MINDSTORMS RCX, the associated IR Tower and the leJOS environment (see below), you will need:
set LEJOS_HOME=< your lejos directory >
set PATH=%PATH%;%LEJOS_HOME%\bin
set
CLASSPATH=%CLASSPATH%;.;%LEJOS_HOME%/lib/classes.jar;%LEJOS_HOME%/lib/pcrcxcomm.jar
set RCXTTY=COM1
or set RCXTTY=usb
. bin
directory of your leJOS installationfirmdl.bat
If the download doesn't work, make sure that
firmdl
.
The original LEGO® firmware
isn't deleted from the RCX, but stored away. Hence you may re-activate
it by just removing the batteries for some minutes and replacing it.
The leJOS firmware will be lost in this case, though, and will have to
be downloaded again to be useable on the RCX.
Note that you have to install the leJOS firmware only once (unless
removing the batteries); nevertheless it may be downloaded as often as
you wish, but the leJOS programs you have installed will be lost in
this case.
import josx.platform.rcx.*;
public class DistributionSmokeTest
{
public static void main (String[] args) throws Exception
{
LCD.clear();
TextLCD.print ("SMOKE");
Thread.sleep(1000);
TextLCD.print ("TEST");
Thread.sleep(1000);
}
}
To run this program, you will:
check
directory of your leJOS installationlejosjc.bat
:lejosjc.bat Distribution
SmokeTest
.java
lejos
:lejos.bat
DistributionSmokeTest
lejosjc
or lejos
isn't found, make sure
your PATH variable is set accordingly. Congratulations! You have run your first leJOS program on your RCX.
Yet, if it doesn't, feel free to post your question to the lejos discussion list.
Start of Tutorial > Start of Trail |