android 应用程序的构建方式是,当数据(单击按钮)发送到 USB 设备时,LED 切换并显示数据。我希望在没有任何人工干预的情况下连续发送数据。请帮助
if (mInputStream != null)
{
int Data = 0;
try {
Data = mInputStream.read();
} catch (IOException e) {
}
if (Data == LED_ON)
{
ledStatus.setText("LED is ON");
}
else if (Data == LED_OFF)
{
ledStatus.setText("LED is OFF");
}
else
{
ledStatus.setText("Request failed");
}
}
else
{
ledStatus.setText("mInputStream == null");
}