Java android studio通过usb与arduino进行串行通信
我正试图通过usb在arduino nano和我的应用程序之间传递数据。 我正在使用图书馆 在使用提供的示例代码进行了几次尝试后,我尝试测试该问题 我的测试代码:Java android studio通过usb与arduino进行串行通信,java,android,android-studio,arduino,Java,Android,Android Studio,Arduino,我正试图通过usb在arduino nano和我的应用程序之间传递数据。 我正在使用图书馆 在使用提供的示例代码进行了几次尝试后,我尝试测试该问题 我的测试代码: UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE); HashMap<String, UsbDevice> usbDevices = usbManager.getDeviceList(); if (usbDevices
UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
HashMap<String, UsbDevice> usbDevices = usbManager.getDeviceList();
if (usbDevices.isEmpty()) {
Log.d(TAG, "findSerialPortDevice() usbManager returned empty device list." );
}
UsbManager UsbManager=(UsbManager)getSystemService(Context.USB_服务);
HashMap usbDevices=usbManager.getDeviceList();
if(usbDevices.isEmpty()){
d(标记“findSerialPortDevice()usbManager返回空设备列表”);
}
在我的节日里:
<uses-feature android:name="android.hardware.usb.host" android:required="true"/>
问题是UsbManager总是空的,我想电话没有检测到错误
usb设计
我用我的arduino和我的电脑作为usb设备
并尝试使用我的Pocopone、三星平板电脑和另一部三星手机。
我用了两条不同的电缆
我了解到问题可能出在我的设备上(尽管我使用了3台设备)
我使用了usb主机诊断应用程序,结果如下:
我第一次尝试在android中使用任何类型的通信。
谢谢。您好,您解决了这个问题吗?您好,您解决了这个问题吗?