OSDN Git Service

lejos_NXJ_win32_0_5_0beta.zip
[nxt-jsp/lejos_nxj.git] / nxtOSEK / lejos_nxj / samples / LLCMonitor / LLCMonitor.java
1 import lejos.nxt.*;\r
2 import lejos.rcxcomm.LLC;\r
3 \r
4 \r
5 /**\r
6  * Shows Lego IR byes received on the LCD.\r
7  * \r
8  * Requires a Mindsensors NRLink adapter connected to\r
9  * sensor port S1.\r
10  * \r
11  * Point the RCX remote control at the NRLink and see\r
12  * the bytes received, or use any other Lego IR source. \r
13  * \r
14  * @author Lawrie Griffiths\r
15  *\r
16  */public class LLCMonitor {\r
17         public static void main(String[] args) throws Exception {\r
18                 LLC.init(SensorPort.S1);\r
19                 \r
20                 while (true) {\r
21                         int b = LLC.read();\r
22                         \r
23                         if (b >= 0) {\r
24                                 LCD.clear();\r
25                                 LCD.drawInt(b & 0xFF, 3, 0, 0);\r
26                                 LCD.refresh();\r
27                                 Thread.sleep(500);                              \r
28                         }\r
29                 }\r
30         }\r
31 }\r