CS 444 - Week 2 Lecture 1 - 2015-01-27
* several pieces of leJOS knowledge:
* one of the SEVERAL packages in the leJOS API
is:
lejos.nxt
* one of the classes in package lejos.nxt is
Button
* the Button class contains static instances
of the 4 buttons on the NXT brick
* it also contains a number of static methods --
waitForAnyPress
...one of its overloaded versions expects
NO arguments, and waits until any button
on the brick is pressed
* AND... System.out.println, when run on an NXT
brick, DOES print to its little LCD screen...
* SO -- consider Hello444.java (posted along with these
notes!), Java source code using the leJOS API;
* IF you have installed leJOS, and gotten several
paths appropriately set, then (doing so is beyond the
scope of this course, but see:
http://www.lejos.org/nxt/nxj/tutorial/Preliminaries/GettingStarted.htm
...and follow the link from there for your OS if you are
interested in this...)
* you can COMPILE this using:
nxjc Hello444.java
...resulting in compiled bytecode Hello444.class
* BUT the NXT brick with leJOS firmware can't handle
dynamic loading, and so you need to link this to other
stuff it needs using:
nxjlink -o Hello444.nxj Hello444
...resulting in a linked bytecode (I believe) file Hello444.nxj
* THIS is the file you need to upload to your NXT brick --
use:
nxjupload -r Hello444.nxj
...to upload this file to the NXT brick *and* execute it
* if you leave off the -r, it is uploaded but not
immediately executed
* once it is on your brick, you can run it from the brick
as many times as you would like:
* push the center orange button -- you should get initial
leJOS screen shortly followed by its "home" screen
* push the right-arrow button to highlight the files icon
* push the orange button to "open" the files icon
* push the right or left arrow buttons as desired to
select the desired file
* push orange button to open the selected file
* push orange button to execute that program
* (and push any button, in Hello444.nxj program's case,
to END that program!)
* on to Project 1 - Stage 1!
* includes instructions for compiling, linking, and uploading
from BSS 315 lab workstations,
along with instructions for running a program on the NXT brick