OSDN Git Service

lejos_NXJ_win32_0_5_0beta.zip
[nxt-jsp/lejos_nxj.git] / nxtOSEK / lejos_nxj / samples / DLTest / DLTest.java
1 import lejos.nxt.*;\r
2 import lejos.util.*;\r
3 \r
4 /**\r
5  * Test of the DataLogger class. Logs 600 floating point \r
6  * numbers and then transmits them to the PC.\r
7  * \r
8  * Run lejos.pc.tools.DataViewer on the PC to view the logged data.\r
9  * \r
10  * Once the program has transmitted data to the PC, it waits\r
11  * for a button press. Press ENTER to log and transmit more data,\r
12  * or ESCAPE to exit the program.\r
13  * \r
14  * The sample is set up to transmit over Bluetooth. To use\r
15  * USB, set the parameter to transmit to true;\r
16  * \r
17  * @author Roger Glassey and Lawrie Griffiths\r
18  *\r
19  */\r
20 public class DLTest\r
21 {\r
22    public static void main(String[] args)\r
23    {\r
24       int size =600;\r
25 \r
26       Datalogger dl = new Datalogger();\r
27       boolean more = true;\r
28       while(more)\r
29       {\r
30          for(int i = 0 ; i<size; i++)\r
31          {\r
32             float x = i*0.5f;\r
33             dl.writeLog(x);\r
34          }\r
35          dl.transmit(false); \r
36          dl.reset();\r
37          LCD.clear();\r
38          LCD.drawString("more?",0,2);\r
39          LCD.refresh();\r
40          more = 1 == Button.waitForPress();\r
41       }\r
42    }\r
43 }\r
44 \r