【发布时间】:2012-08-08 17:08:47
【问题描述】:
我想通过串口从 Arduino 接收数字引脚值 1(高)或 0(低)。
我无法使用以下代码读取任何数据:
byte[] bbuffer = new byte[1];
try {
mInputStream.read(bbuffer);
}
catch (IOException e) {
new Exception("Arduino-Board antwortet nicht! Timeout!!");
}
if (bbuffer[0] == (byte)1){
PinValue.setText("HIGH");
}
else if (bbuffer[0] == (byte)0){
PinValue.setText("LOW");
}
【问题讨论】:
-
请注意代码格式。这次我给你修好了
标签: java android serial-port arduino