Qt writes andriod end mobile phone to control smart car---Bluetooth car

I have been fine recently. I wrote a Bluetooth remote control with Qt. The effect is okay. Post it for everyone to see.
Software app (BlueCar):

 

Double-click the app to enter the Bluetooth connection interface, find the Bluetooth serial port module HC-06, click and double-click:

 

Wait for 5 seconds, and then prompt to connect successfully.

 

Click ok to enter the control interface:

Next, we will introduce the control interface separately: in the
above figure, the red boxes on the left and right are buttons to control the movement, forward, backward, left, right, left in place, and right in place. Click these buttons to send the response hexadecimal command via Bluetooth, and the sent hexadecimal command will be displayed in the output command display area in real time

 

Open the serial port debugging tool and test the physical communication. (I used the Bluetooth module HC-06 to connect the USB to serial port module)
The content displayed in the serial data receiving area is sent over after clicking the software control button.

 

You can also send special string data to the app through the serial data assistant to control the on and off of the indicator light on the app. Application scenarios such as obstacle sensing prompts. You can also send other custom commands, such as real-time display of the speed of the car.

 

Communication command set protocol:

BlueCar sends message data format definition

first name

Header

Command

Length

Payload

Cheacksum 

size

1 byte

1 byte

1 byte

N bytes

1 byte

Description

Identifier

Command/response type

Data length

data

Checksum

Command:

         0x68: Issue instructions

Command issuance (blueCar sends commands to the receiving end)

Commands

01:   Operating mode          

       Automatic: 68 01 01 01 6B

                 Manual: 68 01 01 00 6A

02 forward: 68 02 00 6A

03 back: 68 03 00 6B 

04 Turn left: 68 04 00 6C 

05: Turn right: 68 05 00 6D 

06: Rotate counterclockwise in place: 68 06 00 6E

07: Rotate clockwise in place: 68 07 00 6F

08: Shooting: 68 08 00 70

09: Horn: 68 09 00 71

10: Function key_1: 68 0A 00 72

11: Function key_2: 68 0B 00 73

12: Function key_3: 68 0C 00 74

13: Function key_4: 68 0D 00 75

18: Speed ​​setting: 68 0E 04 XX XX XX XX Checksum

Stop motion: 68 0F 00 77

 

Command reception (the receiving end sends data to blueCar, and blueCar displays the status or data)

Control LED: "$"+"Message"+"#"

14: Indicator light_1: 

On: "$0101#"

Off: """$0100#"

 

15: Indicator_2:

On: "$0201#"

Off: “$0200#”
16: Indicator light_3:

On: "$0301#"

Off: "$0300#"

17: Indicator light_4:

              On: "$0401#"

           Off: "$0400#"

 

 

Other display: send string directly

Software download connection: https://download.csdn.net/download/hs977986979/12804515

Welcome everyone to communicate and learn QQ: 2284108152

 

 

         

 

 

 

 

 

Guess you like

Origin blog.csdn.net/hs977986979/article/details/105238816