-
-
Save wwj718/a6bcf832b6170b932a7264d37bdaee9a to your computer and use it in GitHub Desktop.
# python3.6 ubtrobot alpha1p | |
from serial.tools.list_ports import comports as list_serial_ports | |
ports = list_serial_ports() | |
for i in ports: | |
print(i[0]) | |
print(i[1]) | |
print(i[2]) | |
# 00010039_PID 是确定的吗 | |
''' | |
COM1 | |
通信端口 (COM1) | |
ACPI\PNP0501\1 | |
COM3 | |
Bluetooth 链接上的标准串行 (COM3) | |
BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}_LOCALMFG&0000\8&2B048E4D&0&000000000000_00000000 | |
COM4 | |
Bluetooth 链接上的标准串行 (COM4) | |
BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}_VID&00010039_PID&5050\8&2B048E4D&0&881B9906E566_C00000000 | |
''' | |
import serial | |
port = "COM4" | |
ser = serial.Serial(port) | |
print(ser.name) | |
cmd = [0xFB,0xBF,0x0b,0x03, 0xd7,0xf3,0xb3,0xf6,0xc8,0xad ,0xf6,0xED] | |
ser.write(serial.to_bytes(cmd)) |
新的机器人 BTHENUM{00001101-0000-1000-8000-00805F9B34FB}_LOCALMFG&0000\8&2B048E4D&0&000000000000_00000000
规则: https://msdn.microsoft.com/en-us/library/windows/hardware/ff536681(v=vs.85).aspx
蓝牙驱动程序堆栈根据以下模板生成硬件ID:
BTHENUM \ { ServiceGUID } _VID& nnnnnnnn
BTHENUM \ { ServiceGUID } _VID& nnnnnnnn _PID& nnnn
BTHENUM \ { ServiceGUID } _LOCALMFG& nnnn
新的机器人 win7
COM6
Bluetooth 链接上的标准串行 (COM6)
BTHENUM{00001101-0000-1000-8000-00805F9B34FB}_LOCALMFG&0000\9&1C8BD124&0&000000000000_00000000
COM8
Bluetooth 链接上的标准串行 (COM8)
BTHENUM{00001101-0000-1000-8000-00805F9B34FB}_LOCALMFG&0000\9&1C8BD124&0&000000000000_00000001
COM5
Bluetooth 链接上的标准串行 (COM5)
BTHENUM{00001101-0000-1000-8000-00805F9B34FB}_VID&00010039_PID&5050\9&1C8BD124&0&881B9906E566_C00000000
COM7
Bluetooth 链接上的标准串行 (COM7)
BTHENUM{00001101-0000-1000-8000-00805F9B34FB}_VID&00010039_PID&5050\9&1C8BD124&0&881B9908AF2D_C00000000
确认是蓝牙和00010039_PID就行