Welcome to 16-channel Servo Debugging Board repository
Serial port control servo
1. Learning objectives
In this course, we mainly learn to use STM32F103RCT6 and 16-way servo drive modules to implement serial port control servos.
2. Prepare before class
In this example, the 16-way servo drive module adopts serial port communication, and the TXD and RXD of the module are connected to the PA3 and PA2 pins of the STM32F103RCT6 board, respectively. VCC and GND are connected to the 3.3V and GND of the STM32F103RCT6, respectively.
3. Programming
Initialize serial ports, interrupts, delays, etc.
The servo control function, according to the protocol, 0x24 and 0x23 are the header and tail of the packet, respectively. 
Control the servo S1 with a for cycle, select 5 degrees each time from 0 to 180, and finally return to 0 degrees.
4. Experimental phenomenon
After the program is downloaded, it runs, and the servo goes from 0 degrees to 180 degrees, and then back to 0 degrees.