舵机: 77 68 06 00 02 36 03 50 E3 0A //舵机 逆时针变小,顺时针变大;(-60~-100)(C4,9C) 77 68 06 00 02 36 03 10 C4 0A #-60度位置 77 68 06 00 02 36 03 10 9C 0A #-100度位置 port 触碰开关: 77 68 04 00 01 DD 01 0A port color rgb灯:77 68 08 00 02 3B 02 01 FF FF FF 0A 蜂鸣器:77 68 06 00 02 3D 03 02 0A 超声测距传感器:77 68 04 00 01 D1 01 0A 按键开关://77 68 05 00 01 DB 01 01 0A 77 68 05 00 01 E1 01 01 0A 编码电机指令: 77 68 06 00 02 0C 01 01 50 0A 77 68 06 00 02 0C 01 01 00 0A comma_head_01_motor = bytes.fromhex('77 68 06 00 02 0C 01 01') comma_head_02_motor = bytes.fromhex('77 68 06 00 02 0C 01 02') comma_head_03_motor = bytes.fromhex('77 68 06 00 02 0C 01 03') comma_head_04_motor = bytes.fromhex('77 68 06 00 02 0C 01 04') comma_trail = bytes.fromhex('0A') portx = "/dev/ttyUSB0" bps = 115200 send_data_01_motor = comma_head_01_motor + left_front.to_bytes(1, byteorder='big', signed=True) + comma_trail send_data_02_motor = comma_head_02_motor + right_front.to_bytes(1, byteorder='big', signed=True) + comma_trail send_data_03_motor = comma_head_03_motor + left_rear.to_bytes(1, byteorder='big', signed=True) + comma_trail send_data_04_motor = comma_head_04_motor + right_rear.to_bytes(1, byteorder='big', signed=True) + comma_trail