Create
- Start Eclipse.
- From the File menu select New and then LeJOS NXT Project.
- Eclipse will popup the New LeJOS NXT Project dialog. Enter HelloWorld in the Project name textbox and click on the Finish button.
- The New LeJOS NXT Project dialog will close.
- From the File menu select New and then Class.
- Eclipse will popup the New Java Class dialog. Enter HelloWorld in the Name textbox, enter examples in the Package textbox, check the public static void main and click on the Finish button.
- Eclipse will generate an empty class with a main method. Add the import lejos.nxt.*; and the usual System.out.println("Hello World"); statement. Finally enter the following statement Button.waitForAnyPress();. See the example below.
Upload
Assuming there are no errors...- Ensure the NXT is plugged in to the USB port and power on.
- From the File menu select Run, then Run As and then LeJOS NXT Program.
- Sometime later you should here the NXT beep and display 'Hello World'.
References
Intelligence Unleashed. Brian Bagnall. ISBN 978-0-9868322-0-8
No comments:
Post a Comment