120 likes | 270 Views
Set up the Environment for leJOS NXJ. Required Software. Software JDK 1.6 leJOS NXJ USB driver for NXT Mindstorm nxt USB driver Libusb. MMN Lab. leJOS Installation. The following instructions are written for Windows XP.
E N D
Required Software • Software • JDK 1.6 • leJOS NXJ • USB driver for NXT • Mindstorm nxt USB driver • Libusb MMN Lab.
leJOS Installation • The following instructions are written for Windows XP. • Extract lejos_NXJ_win32_0_6_0beta.zip to your desired directory. (ex: C:\lejos_nxj) • Execute jdk-6u10-windows-i586-p.exe and install JDK on your computer. MMN Lab.
leJOS Installation cont’d • Install mindstorm nxt USB driver • Execute libusb-win32-filter-bin-0.1.12.1.exe to install the USB driver • For Vista user, you need additional steps • Right click on this file. Select Properties | Compatibility Click the "Run this program in compatibility mode" box and select "Windows XP (Service Pack2)" from the drop down list. • Right click again and select "Run as Administrator". Follow the installation instructions. Run the test program will list the usb devices plugged into your computer, but not new devices. MMN Lab.
Environment variable • 控制台>系統>進階>環境變數 • NXJ_HOME: Your leJOS directory(ex: C:\lejos_nxj) • JAVA_HOME: Your JDK directory(ex: C:\Program Files\Java\jdk1.6.0_07) • You can reference pictures on the next page MMN Lab.
Environment variable cont’d MMN Lab.
Environment variable cont’d • Add Path for JDK and leJOS • C:\lejos_nxj\bin;C:\Program Files\Java\jdk1.6.0_07\bin MMN Lab.
Flash the firmware • NXT must be plugged into the USB and turned on first. • Press the reset button (at the back of the NXT , upper left corner) for more than 4 seconds. Your NXT will audibly tick when it is firmware update mode. • 開始>執行>cmd • Command: C:\lejos_nxj\bin\nxjflash Then the firmware will be updated. MMN Lab.
Flash the firmware cont’d MMN Lab.
First program • Open Notepad and enter the following code: MMN Lab.
First program cont’d • Open cmd and cd to the directory containing your HelloWorld.java (ex: cd C:\lejos_nxj\code) • Compile: nxjc HelloWorld.java • Upload to NXT: nxj –r HelloWorld • Without –r, the program will not run after uploading and you can run it on NXT yourself.(Make sure NXT is turned on before uploading) MMN Lab.
Lab1 • Reference the first program and write a program to show all the student numbers of your group members. • NOTE: You can turn off the NXT by pressing the orange and dark gray buttons (ENTER + ESCAPE) together. MMN Lab.