AVR-C question

Hi everyone.
I have recently been delving into some avr-c using avr-gcc on linux in order to gain a better understanding of what is under the hood of arduino.
I have been following a tutorial series on youtube by HumanHardriveDrive, i have been getting a good feel for how registers work but im kinda stuck on a PWM example, i can get it working but when it comes to trying it on a different pin i cant seem to get it to work. im trying to get it to run on pin PB3 of the atmega328p which is also a PWM pin, so i have tried changing the code to DDRB |= 0x08; when that didn’t work i tried changing things like OCR0A to OCR2A.
I cant see any further reference to the pin in the code so I'm not quite understanding how this works, i have looked in datasheet and only see reference to OCR0A, TCCR0A an not variations for different pins. the led did light up after changing a few zeroes into 2's but its no longer changing its brightness. Any help would be much appreciated.

/*
* PWM
*
*
*/


#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>

double dutyCycle = 0;

int main(void) {


	DDRD |= 0x40;



	TCCR0A = (1 << COM0A1) | (1 << WGM00) | (1 << WGM01);
	TIMSK0 = (1 << TOIE0);

	OCR0A = (dutyCycle/100)*255;

	sei();

	TCCR0B = (1 << CS00) | (1 << CS02);

	while(1) {

		_delay_ms(100);

		dutyCycle += 10;

		if(dutyCycle > 100) {
			dutyCycle = 0;
		}

	}
}

ISR(TIMER0_OVF_vect) {

	OCR0A = (dutyCycle/100)*255;
}

When dealing with registers, it is crucial to also study the datasheet for the processor.

As Delta G says, some time with the data sheet is required.

There is a problem in your sketch in that the prescaler (clock divider) settings are different between Timer0 and Timer2.

/*
* PWM
*
*
*/

#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>

double dutyCycle = 0;

int main(void) {

  //DDRD |= 0x40;//PD6 Digital pin6 Timer0 COM0A
   DDRB |= 0x08;//PB3 Digital pin 11 Timer2 COM2A

  //TCCR0A = (1 << COM0A1) | (1 << WGM00) | (1 << WGM01);
  TCCR2A = (1 << COM2A1) | (1 << WGM20) | (1 << WGM21);
  //TIMSK0 = (1 << TOIE0);
  TIMSK2 = (1 << TOIE2);

  //OCR0A = (dutyCycle/100)*255;
  OCR2A = (dutyCycle/100)*255;

  sei();

  //TCCR0B = (1 << CS00) | (1 << CS02);//clock divider 1024
  //NB different clock divider registers for 1024 divider Timer2
   TCCR2B = (1<<CS22) | (1<<CS21) | (1<<CS20);

  while(1) {

    _delay_ms(100);
    

    dutyCycle += 10;

    if(dutyCycle > 100) {
      dutyCycle = 0;
    }

  }
}

//ISR(TIMER0_OVF_vect) {
//  OCR0A = (dutyCycle/100)*255;
//}

ISR(TIMER2_OVF_vect) {
  OCR2A = (dutyCycle/100)*255;
}

Thank-you very much for going to such trouble cattledog. that example has helped me understand much more clearly, I would never of guessed so much needed to be changed just to change from one pin to another, i didn’t find the datasheet to be too clear on this but then I haven’t read it back to back yet, seems I must take Delta_g's advice an do just that.