android东西到olimax板

时间:2018-10-16 14:02:33

标签: android-things

如何将Android设备连接到olimax板。

我想创建Iot应用程序,为此,我需要将Android Things应用程序连接到Olimax板。

预先感谢

1 个答案:

答案 0 :(得分:0)

非常好的文档: https://imgur.com/a/Su8aSg7

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板和Raspberry pi板之间连接了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");
}