Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The environment variable LEJOS_NXT_JAVA_HOME is set in the installation tutorial by editing ~/.profile. However, on a Mac the environment variables defined in this file are not visible for GUI Applications, only for apps started from terminal. Thus to use leJOS together with KIELER, one either has to start KIELER from terminal or set the environment variable so that all GUI applications can access it, which seems . However, this does not seem to be not trivial on Mac (see also http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x).

...

Note: Java 1.8 is needed on all operating systems, with . With Java 1.7 not all plugins of KIELER will be loaded. On Furthermore on Windows, you will need to download the 32 Bit version of KIELER – even if you have a 64 bit operating system! Otherwise flashing the brick and uploading to the brick will fail.

...

After the installation, the plugin requires a little configuration. Go to Window > Preferences > leJOS NXJ (Window > Preferences > leJOS EV3 respectively) and enter the base directory of your leJOS installation in the NXJ_HOME field.

For EV3, the plugin requires the IP address to connect to the brick (it may work without, but its safer to directly set the name. Reduces headache (wink)). Check Connect to named brick and enter the IP adress of the brick (displayed on the brick at startup).

...

The following shows how to create a project, that which will turn on a light if a button is pressed.

...

The available wrapper code snippets are defined in the snippets directory of the project in ftl files (FreeMarker template files). The table below gives an overview of the available wrapper code snippets.

Note: The Floodlight of the EV3 has a pretty high latency when switching between on and off.

...

For a deeper understanding of the project launch and initialization, take a look at the wiki page for Prom.

Available Wrapper Code Snippets

There are several wrapper code snippets that can be used on input and output variables in the model file. These snippets are inserted in the main file template as part of the project launch. The available snippets are listed below.

For sensors, the port has to be on of S1, S2, S3, S4.

For motors the port has to be one of A, B, C, D.

Snippet Name and ParametersDescriptionUse onVariable typeRemark
Clock, millisecondsSets a variable to true if the time in milliseconds passedinputboolSee also ResetClock.
ResetClock, clockVariableName, autoFalse

Resets a clock, such that the full time intervall of the clock has to elapse, before the clock will be set to true again.

If autoFalse is true, the reset variable will be set to false automatically.

outputboolautoFalse is true per default.
TimeReads the elapsed time since program startinputint 
TickDuration, targetInMilliseconds

Delays the execution until the tick loop takes at least as long as the given target duration.

The input variable is set to the actual tick loop duration.

inputintShould be used on the very first input variable in the model, such that waiting is the last action in the tick loop.
SleepLets the current thread sleep the time in milliseconds of the variable value.outputint 
Print, autoResetPrints a string variable if the string is not empty. If autoReset is true then the string variable is set to the empty string after it has been printedoutputstringautoReset is true per default.
DrawString, x, yPrints a string to the given x and y coordinate on the LCD.outputstring 
Button, buttonIdSets a variable to true iff the button on the Mindstorms device is pressed.inputboolThe buttonId has to be one of ENTER, LEFT, RIGHT
TouchSensor, portSets a variable to true iff the touch sensor on the given port is pressed.inputbool 
LightSensor, port, percentValue

Reads  the value of a light sensor.

If percentValue is true, the a percent value is retured, based on the light sensor calibration.

inputintpercentValue is not available on EV3
CalibrateLightSensor, port, signalCalibrates a light sensors high or low values. This means if the variable is true, the current value of the light sensor is taken as its reference high / low value.outputboolsignal has to be one of High, Low
Floodlight, portReads / Sets the state of the red lamp of the light sensor.

input

output

bool 
RCXLamp, portTurns an RCX lamp on (variable is true) or off (variable is false)outputbool 
MotorSpeed, port, brakeReads / Sets the speed of the motor in degrees per minute. If the speed value is negative, the motor will drive backwards. If the speed is zero, the motor will actively brake until it stops (brake is true) or remove all power and rollout (brake is false).

input

output

intbrake is true per default.
MotorIsMoving, portSets a variable to true iff the motor on the given port is moving.inputbool 
MotorRotation, port

Lets a motor rotate the variable value in degrees. This is only done if the value is unequal zero. If the value is negative, the motor rotates backwards. The variable is set to zero afterwards, such that setting the variable once to a value X, will let the motor rotate X degrees.

outputint 
Beep, volumePlays a beep sound as long as the variable is true.outputbooldefault volume is 10
Buzz, volumePlays a buzz sound as long as the variable is true.outputbooldefault volume is 10
BeepSequence, direction, volume

Plays a sequence of tones in either ascending or descending tone frequency if the variable is true.

The variable is set to false automatically.

outputbool

direction has to be one of Up, Down

default volume is 10

UltrasonicSensor, portReads the distance that an ultrasonic sensor measures.inputint 
Gyro, port, modeReads the value of a gyroscope.inputint

Not available on NXT

mode hat to be one of Angle, Rate

CalibrateGyro, port, autoReset

Resets a gyroscope if the variable is true.

If autoReset is true, the variable is set to false automatically.

outputboolautoReset is true per default

 

...

Using the Remote Console (RConsole)

...

IssueTypical Error MessagesDescriptionSolution
leJOS EV3 does not support Java 8

"java.lang.UnsupportedClassVersionError"

"unsupported major.minor version"

You compile the sources in your project with Java 8 and upload them to the brick. However the lejos EV3 does not support Java 8Go to the project properties and switch to Java 7 (Right Click on project > Properties > Java Compiler > Compiler compliance level)
Uploading to the brick does not respond You compile a file successfully and when uploading the result, the connected brick is found. Anyway the upload does not terminate and does not react.Flash the brick with the current leJOS firmware. If the brick is recognized correctly and the attempt to upload a compiled file fails then the firmware on the brick might be outdated.
Compilation and uploading works from command line but not when using KIELER

This Java instance does not support a 32-bit JVM. Please install the desired version.

You can compile and upload code to the brick using the command line tools but when using KIELER an error message apprears because Java does not support 32-bit JVM.Set the LEJOS_NXT_JAVA_HOME environment variable, such that it points to an 32-bit JDK and is visible for GUI applications (or at least KIELER). The process to do so differs on every OS. As alternative, execute KIELER from terminal.
Brick does nothing after program finished and prints "Program exit" A program was uploaded and finished without errors. Afterwards the brick prints "Program exit" but does not open the main menu.

This is normal behaviour if uploading a program in debug mode instead run mode (Debug As instead Run As in Eclipse). To get back to the main menu, press the ENTER and ESCAPE button of the brick at the same time.

 

 

input