Hallo Interessierte,
ich verstehe nicht, wie das PWM hier Vorwaerts und Rueckwaerts steuert?
https://github.com/espressif/esp-idf/blob/master/examples/peripherals/mcpwm/mcpwm_brushed_dc_control/main/mcpwm_brushed_dc_control_example.c
1  | /**
  | 
2  |  * @brief motor moves in forward direction, with duty cycle = duty %
  | 
3  |  */
  | 
4  | static void brushed_motor_forward(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num , float duty_cycle)
  | 
5  | {
 | 
6  |     mcpwm_set_signal_low(mcpwm_num, timer_num, MCPWM_OPR_B);
  | 
7  |     mcpwm_set_duty(mcpwm_num, timer_num, MCPWM_OPR_A, duty_cycle);
  | 
8  |     mcpwm_set_duty_type(mcpwm_num, timer_num, MCPWM_OPR_A, MCPWM_DUTY_MODE_0); //call this each time, if operator was previously in low/high state
  | 
9  | }
  | 
10  | 
  | 
11  | /**
  | 
12  |  * @brief motor moves in backward direction, with duty cycle = duty %
  | 
13  |  */
  | 
14  | static void brushed_motor_backward(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num , float duty_cycle)
  | 
15  | {
 | 
16  |     mcpwm_set_signal_low(mcpwm_num, timer_num, MCPWM_OPR_A);
  | 
17  |     mcpwm_set_duty(mcpwm_num, timer_num, MCPWM_OPR_B, duty_cycle);
  | 
18  |     mcpwm_set_duty_type(mcpwm_num, timer_num, MCPWM_OPR_B, MCPWM_DUTY_MODE_0);  //call this each time, if operator was previously in low/high state
  | 
19  | }
  | 
Ich habe eine passende H-Bruecke, dass funtioniert 1A, allerdings muss 
ich zwei PINs high/low setzen. Kein Drama und funktioniert super. Aber 
was ist die Idee hinter dem Beispielcode?