Need to use PWM for managing the LED intensity using Arduino uno

Hello,

Requirement: Change the intensity of LED using the PWM output of Arduino uno.

Current code that I am using:

#include „periph/pwm.h“

#define PWM_FREQ (1000000U)

#define PWM_RES (255U)

void setup(void) {

pwm_init(TCCR0A, PWM_LEFT, PWM_FREQ, PWM_RES);

}

Void loop(void){

pwm_set(TCCR0A, 6, 125);

}

This code gets compiled successfully but the execution get blocked at pwm_init line.

Is there anything wrong with the parameters that I am passing with the pwm_init function??

Best Regards,

Hi Jaywant,

I don't know why pwm_init() blocks, but I noticed this: