Question.3
What will be the duty cycle of the PWM signal generated on digital pins 3 and 11 of Arduino UNO, respectively, after execution of the following code?
Note: Arduino Clock frequency = 16MHz with 1024 Prescaler.
Code
void setup() {
pinMode(3, OUTPUT); // OC2B
pinMode(11, OUTPUT); // OC2A
// Configure Timer2 for Fast PWM, Non-Inverting Mode with 1024 prescaler, Clear OC2A/OC2B on compare match when up-counting
TCCR2A = (1 << WGM21) | (1 << WGM20) | (1 << COM2B1) | (1 << COM2A1);
TCCR2B = (1 << WGM22) | (1 << CS22) | (1 << CS21) | (1 << CS20);
OCR2A = 79; // pin 11
OCR2B = 19; // pin 3
}
void loop() {
}