Java Programming

RCX bricks are incredible little microcontrollers. To unleash more of their potential, a more powerful language than RIS is needed. Java is the ideal language and we use the LeJOS (Lego Java Operating System) SDK for programming. Part of our effort is to use robots as a manipulative to help with the learning process of Java. Java is an object-oriented programming. But objects, including methods and properties, can be hard to understand on an abstract, cognitive level. But having a physical object to map to the programming objects leads to better cognitive model creation and understanding. There is a whole lot more educational theory behind this but simple terms work better. A Mindstorms kit comes with two motors. These motors are phyiscal instances of the real world class motor. They also map directly, but are distinctly different, to the programming class and its instances Motor.A and Motor.C. The mapping between programming model and the real world model enhances the learning process. In real terms, which is more motivating to learn how to program: writing programs that the teacher may run once and then throw away or writing programs for a toy that competes against other students' toys?

In any case, we are currently working on a book for a class offered at Kansas State. This is a work in progress, please be kind and please send comments, and chapters will be added, hopefully before the syllabus requires them. Chapters are in separate pdf files. At the bottom of the list is a zip file that contains several example programs. Note, we believe that LeJOS as it currently is distributed has an Arbitrator class that is not very robust. Our computer science department has a better version that is available upon request.

Learning Java with Robots by William J Rust

  1. Introduction to the book.
  2. Introduction to objects.
  3. RIS, including discussion of concepts such as what makes a program, algorithms, polling and interrupts.
  4. Setting up a programming environment, including detailed on installing and configuring j2sdk, Lejos and JCreator LE.
  5. Comparison of RIS to Java code.
  6. Navigation, how to get your robot there and back.
  7. The Java Language Reference, really, really abridged.
  8. Example code, including mazerunner and linefollower using polling, interrupts and behaviors and using the RCX as a micro-controller.