【发布时间】:2014-10-21 08:42:02
【问题描述】:
私人无效发送数据(字符串消息){ byte[] msgBuffer = message.getBytes();
Log.d(TAG, "...Send data: " + message + "...");
try {
outStream.write(msgBuffer);
} catch (IOException e) {
String msg = "In onResume() and an exception occurred during write: "
+ e.getMessage();
if (address.equals("00:00:00:00:00:00"))
msg = msg
+ ".\n\nUpdate your server address from 00:00:00:00:00:00 to the correct address on line 35 in the java code";
msg = msg + ".\n\nCheck that the SPP UUID: " + MY_UUID.toString()
+ " exists on server.\n\n";
errorExit("Fatal Error", msg);
}
}
在上面的代码中,我们可以发送像“0”和“1”这样的数据。但想发送 8 位,如 00000000 和 00000001。它应该显示在 Arduino 板上。如果按发送数据 1 应该显示 00000001 和 00000000。
【问题讨论】: