OVMS3-idf/examples/peripherals/mcpwm/mcpwm_brushed_dc_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 MCPWM API doc update 2018-10-10 08:15:23 +08:00

MCPWM brushed dc motor control Example

This example will show you how to use MCPWM module to control brushed dc motor, you need to make connection between ESP32 and motor driver

This code is tested with L298 motor driver, user needs to make changes according to the driver they use

Motor first moves forward, then backward and then stops for 2 Secs each countinuously

Step 1: Pin assignment

  • GPIO15 is assigned as the enable/input 1 for motor driver
  • GPIO16 is assigned as the enable/input 2 for motor driver

Step 2: Connection

  • connect GPIO15 with input 1 of motor driver
  • connect GPIO16 with input 2 of motor driver

Step 3: Initialize MCPWM

  • You need to set the frequency and duty cycle of MCPWM timer
  • You need to set the MCPWM unit you want to use, and bind the unit with one of the timers