2020-04-09 08:40:57 +00:00
|
|
|
| Supported Targets | ESP32 |
|
|
|
|
| ----------------- | ----- |
|
|
|
|
|
2017-03-29 08:39:35 +00:00
|
|
|
# MCPWM servo motor control Example
|
|
|
|
|
|
|
|
This example will show you how to use MCPWM module to control servo motor
|
|
|
|
|
|
|
|
Assign pulse width range and the maximum degree, accordingly the servo will move from 0 to maximum degree continuously
|
|
|
|
|
|
|
|
|
|
|
|
## Step 1: Pin assignment
|
2019-02-27 12:02:57 +00:00
|
|
|
* GPIO18 is assigned as the MCPWM signal for servo motor
|
2017-03-29 08:39:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
## Step 2: Connection
|
2019-02-27 12:02:57 +00:00
|
|
|
* connect GPIO18 with servo pwm signal
|
2017-03-29 08:39:35 +00:00
|
|
|
* other two wires of servo motor are VCC and GND
|
|
|
|
|
|
|
|
|
|
|
|
## Step 3: Initialize MCPWM
|
|
|
|
* You need to set the frequency(generally 50 Hz) and duty cycle of MCPWM timer
|
|
|
|
* You need to set the MCPWM channel you want to use, and bind the channel with one of the timers
|