Im struggling with peace of code. Can someone tell me what Im doing wrong
and give me same explanation please.
class Looper extends BaseIOIOLooper {
Uart uart;
InputStream in;
double latitude, longitude;
public void setup() throws ConnectionLostException {
uart = ioio_.openUart(12, 11, 9600, Uart.Parity.NONE, Uart.StopBits.
ONE);
in = uart.getInputStream();
}
public void loop() throws ConnectionLostException {
try {
if (in.available() != 0){
latitude = in.read();
longitude = in.read();
// append to terminal
String s1 = "" + (char)latitude;
appendText(s1);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void appendText(final String s1) {
// TODO Auto-generated method stub
runOnUiThread(new Runnable() {
@Override
public void run() {
txtLatitude.setText(String.format("%.6f", latitude));
txtLongitude.setText(String.format("%.6f", longitude));
}
});
}
}
--
You received this message because you are subscribed to the Google Groups
"ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/groups/opt_out.