Welcome to 24-channel Servo Drive Board repository
2.2 STM32
STM32 Control servo board
Learning objectives
In this course, we mainly learn to use STM32F103C8T6 and 24 channel servo drive module to realize serial port control servo.
Preparation
In this example, the 24 channel servo drive module uses serial communication, and the TXD and RXD of the module are connected to the PA3 and PA2 pins of the STM32F103C8T6 board respectively. VCC and GND are respectively connected to 3.3V and GND of STM32F103C8T6. As shown in the figure.

3.Code
Initialize serial port, interrupt, delay, etc.

Servo control function. According to the protocol, 0x24 and 0x23 are the header and trailer of data packets respectively.

Use for to cycle control servo-S1, select 5° from 0 to 180 each time, and finally return to 0°.

4.Experimental phenomenon
After the program is downloaded, the servo is turned from 0 ° to 180 °, and then returns to 0 °.