esp-idf/examples/peripherals/mcpwm/mcpwm_servo_control
Konstantin Kondrashov 399d2d2605 all: Using xxx_periph.h
Using xxx_periph.h in whole IDF instead of xxx_reg.h, xxx_struct.h, xxx_channel.h ... .

Cleaned up header files from unnecessary headers (releated to soc/... headers).
2019-06-03 14:15:08 +08:00
..
main all: Using xxx_periph.h 2019-06-03 14:15:08 +08:00
CMakeLists.txt cmake: make main a component again 2018-09-11 09:44:12 +08:00
Makefile feature: add Motor Control PWM(mcpwm) driver 2017-05-12 15:47:59 +08:00
README.md Update README.md 2019-03-24 19:54:00 +01: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

  • GPIO18 is assigned as the MCPWM signal for servo motor

Step 2: Connection

  • connect GPIO18 with servo pwm signal
  • 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