2 LEDC channels, 180 deg. apart

mikemoy
Posts: 606
Joined: Fri Jan 12, 2018 9:10 pm

2 LEDC channels, 180 deg. apart

Postby mikemoy » Sun Aug 04, 2019 8:17 pm

I need to have 2 pin fade in and out with the same timing, but with a twist. I need them to be exactly 180 deg. apart from one another.
i.e. when pin(a) is at its highest intensity of it's fade cycle, it's at that point when pin(b) is at its lowest.

PaulNi
Posts: 41
Joined: Tue Nov 07, 2017 3:50 pm

Re: 2 LEDC channels, 180 deg. apart

Postby PaulNi » Sun Aug 04, 2019 8:30 pm

Take a look at a nand gate. But I bet there will be another twist... LED average current and its observable brightness are not linear.

I think there is no alternative than to just use 2 PWM channels.

mikemoy
Posts: 606
Joined: Fri Jan 12, 2018 9:10 pm

Re: 2 LEDC channels, 180 deg. apart

Postby mikemoy » Sun Aug 04, 2019 8:39 pm

Thanks, but the truth be told i need 3 pins, all 120 deg. apart.
I am trying a crazy idea to use 3 LEDC pins to implement SPWM to control a BLDC motor.

ESP_houwenxiang
Posts: 118
Joined: Tue Jun 26, 2018 3:09 am

Re: 2 LEDC channels, 180 deg. apart

Postby ESP_houwenxiang » Mon Aug 05, 2019 1:55 am

Hi, mikemoy

In the LEDC channel configuration parameters, we provide hpoint to configure the phase. Plese note that these three channels need to use the same timer.

Code: Select all

typedef struct {
    int gpio_num;
    ....
    uint32_t duty;
    int hpoint;
} ledc_channel_config_t;
wookooho

Who is online

Users browsing this forum: Bing [Bot] and 235 guests