I have been trying to get a simple pwm signal running for half a day now and I have no clue why it is not working... The doc mentions that after ledc_channel_config the pwm signal should be generated... am I missing something? I am doing nothing else except this.
here is my code:
Code: Select all
ledc_timer_config_t ledc_timer = {
.speed_mode = LEDC_LOW_SPEED_MODE, // timer mode
.duty_resolution = LEDC_TIMER_12_BIT,
.timer_num = LEDC_TIMER_1, // timer index
.freq_hz = 10, // frequency of PWM signal
};
ledc_timer_config(&ledc_timer);
ledc_channel_config_t channel_config = {
.gpio_num = 23,
.speed_mode = LEDC_LOW_SPEED_MODE,
.channel = LEDC_CHANNEL_0,
.intr_type = LEDC_INTR_DISABLE,
.timer_sel = LEDC_TIMER_1,
.duty = 2048,
.hpoint = 0,
};
ledc_channel_config(&channel_config);
ledc_set_duty(channel_config.speed_mode, channel_config.channel, 2048);
ledc_update_duty(channel_config.speed_mode, channel_config.channel);