import lejos.nxt.*;
import lejos.nxt.addon.NXTLineLeader;
import lejos.util.Delay;
class LLRead {
public static void main(String args[]) {
Button.ESCAPE.addButtonListener(new ButtonListener() {
public void buttonPressed(Button b) {System.exit(0);}
public void buttonReleased(Button b) {}
});
NXTLineLeader LL = new NXTLineLeader(SensorPort.S1);
int address;
byte[] buf = new byte[8];
int ret;
int value;
while(true) {
for(address=0x49; address<=0x50; address++) {
ret = LL.getData(address, buf, 2);
value = (ret == 0 ? (buf[0] & 0xff) : -1);
LCD.drawString("S" + (address-0x49) + " " + value, 0, address-0x49);
}
Delay.msDelay(200);
LCD.clear();
}
}
}