02224 Modelling and Analysis of Real-Time Systems - Lejos
02224 Modelling and Analysis of Real-Time Systems Spring 2024
Lejos
LeJOS (Lego Java Operating System)
is a set of tools enabling Java programming of the Lego
RCX brick computer (and its successor NXT).
The main source for LeJOS information is the LeJOS home page:
lejos.sourceforge.net
(RCX part).
Compiling for LeJOS
For this assignment,it is not necessary to install the full
LeJOS tool-set. The special classes comprising the RCX environment will do.
Initially, you may just use the LeJOS emulations provided by the
simulator.
[More instructions may be provided here later.]
LeJOS Programming Caveats
The LeJOS implementation of Java has some issues to which you should
pay attention:
LeJOS does not have garbage collection. Thus, if you create
too many objects, the system runs out of memory. Therefore, be sure
to create objects only once and reuse them. Especially avoid using
string operations.
Note that operations on long are not available. If you use
currentTimeMillis(), you must immediately cast it to an
int
The standard stream System.out is not available for
generating debug traces. Instead you might use LCD.showNumber()
to indicate the progress of your program.
Avoid heavy use of object-oriented programming techniques like
multi-level inheritance etc. Keep the program structure simple.
The switch statement is not available. Use nested
if statements instead.
Synchronization of private methods does not work. Keep
synchronized methods public.
Likewise avoid synchronizing static methods.
No busy waiting since this will violate the timing. Use proper
wait/notify instead.