【发布时间】:2018-11-21 22:34:04
【问题描述】:
如何将 Android 设备连接到 olimax 板。
我想创建 IoT 应用程序,为此我需要将 Android Things 应用程序连接到 Olimax 板。
提前致谢
【问题讨论】:
-
你对Olimax板的代码有控制权吗?
标签: android-things
如何将 Android 设备连接到 olimax 板。
我想创建 IoT 应用程序,为此我需要将 Android Things 应用程序连接到 Olimax 板。
提前致谢
【问题讨论】:
标签: android-things
非常好的文档: https://developer.android.com/things/sdk/pio/uart
manager.getUartDeviceList();
...
11-20 09:00:15.417 1610 1626 I MainActivity: Device found: /dev/bus/usb/001/009 id: 1009
11-20 09:00:15.417 1610 1626 I MainActivity: product name: STM32 Virtual ComPort
11-20 09:00:15.419 1610 1626 I MainActivity: List of available devices: [MINIUART, UART0, USB1-1.5:1.0]
STM32F105 板和树莓派板之间的连接 USB 电缆。因为 Raspberry pi 板可以识别来自 STM32F105 板的虚拟 ComPort,所以您可以直接访问 uartdevice。 我可以使用 (deviceList.get(mydevice) = "USB1-1.5:1.0") 创建一个 UartDevice mDevice:
mDevice = manager.openUartDevice(deviceList.get(mydevice));
最后我可以用这样的东西来写一些数据:
public void writeUartData(UartDevice uart, String data) throws IOException {
int count = uart.write(data.getBytes(), data.length());
Log.d(TAG, "Wrote " + count + " bytes to peripheral");
}
【讨论】: