#眉標=Java #副標=智慧型樂高機器人與Java程式開發(2) #大標=leJOS簡介 #作者=文/圖 何致億 ==程式1 =========== 01. import lejos.nxt.*; 02. 03. public class HelloNXT { 04. public static void main (String[] args) throws Exception { 05. LCD.drawString("Hello NXT",4,4); //決定字串內容與顯示位置 06. LCD.refresh(); //將字串顯示在LCD螢幕 07. } 08. } ================ ==<反灰>=========== lejosjc HelloNXT.java ================ ==<反灰>=========== lejoslink -o <轉換後的lejos可執行檔名稱> ================ ==<反灰>=========== lejoslink HelloNXT -o HelloNXT.lej ================ ==<反灰>=========== NXT not found. Is it properly plugged in via USB? ================ ==程式2 =========== 01. import lejos.nxt.*; 02. 03. public class HelloNXT2 { 04. public static void main (String[] args) throws Exception{ 05. for (int i=0; i<=7; i++) { 06. LCD.drawString("Hello NXT",i,i); 07. LCD.refresh(); 08. Thread.sleep(1000); 09. LCD.clear(); 10. } 11. } 12. } ================ ==程式3 =========== 01. import lejos.nxt.*; 02. 03. public class HelloNXT3 { 04. public static void main (String[] args) throws Exception { 05. for (int i=0; i<=7; i++) { 06. LCD.drawString("Hello NXT",i,i); 07. LCD.refresh(); 08. Thread.sleep(2000); 09. //LCD.clear(); 10. } 11. } 12. } ================