当我只发送1个字母或1个数字时,我的代码工作正常,但现在我尝试编辑它以使其发送两个值和一个":"同样,但由于某种原因,它不起作用。这是我正在使用的代码:
@Override
public void onMove(int angle, int strength) {
mTextViewAngleLeft.setText(angle + "°");
mTextViewStrengthLeft.setText(strength + "%");
command = (angle + ":" + strength + "\n");
try {
outputStream.write(command.getBytes()); //transmits the value of command to the bluetooth module
} catch (IOException e) {
e.printStackTrace();
}
}
命令声明为String
。
答案 0 :(得分:0)
这是预感,但程度符号可能导致问题,请尝试使用Unicode值。 Help with Unicode Value here
答案 1 :(得分:0)
结果是硬件错误(蓝牙无法正常工作)