EasyManuals Logo

LEGO MINDSTORMS Robots User Manual

LEGO MINDSTORMS Robots
226 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #210 background image
mPort.close();
}
catch (IOException ioe) {}
System.exit(0);
}
protected void sendReturn() throws IOException, InterruptedException {
mOut.write('\r');
mOut.flush();
Thread.sleep(kCharSleep);
// Wait for response, or time out.
long savedTime = System.currentTimeMillis();
boolean trucking = true;
while (trucking) {
if (mPortListener.isComplete()) trucking = false;
long currentTime = System.currentTimeMillis();
if (currentTime - savedTime > kTimeOut) trucking = false;
Thread.sleep(20);
}
}
public class PortListener
implements Runnable {
private Thread mThread;
private BufferedReader mIn;
private boolean mComplete = false;
private boolean mError = false;
private String mLastLine;
public PortListener (Reader in) {
mIn = new BufferedReader(in);
mThread = new Thread(this);
mThread.start();
}
public void run() {
String line;
try {
while((line = mIn.readLine()) != null) {
Page 239
line = line.trim();
mLastLine = line;
if (line.indexOf("ok") != -1) mComplete = true;
if (line.indexOf("redefine") != -1) mComplete = true;
if (line.indexOf("undefined") != -1) mComplete = mError = true;
if (line.length() == 0) mComplete = true;
}
}
catch (IOException ioe) {
System.out.println("PortListener: ioe " + ioe);
}
}
public void stop() throws IOException {

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the LEGO MINDSTORMS Robots and is the answer not in the manual?

LEGO MINDSTORMS Robots Specifications

General IconGeneral
Product LineLEGO MINDSTORMS
CategoryToy
Age Range10+
Batteries RequiredYes
Memory64 MB RAM, 16 MB Flash
ConnectivityBluetooth, USB
SensorsTouch, Color, Gyro
Battery TypeAA
Interactive FeaturesProgrammable, Remote Control
App CompatibilityiOS, Android
ProcessorARM9
Pieces Count601
Battery Count6
App NameLEGO MINDSTORMS EV3 Programmer App

Related product manuals