PWM with Timer

Dear Community,

I tried to get a sine-wave by using pwm on my Arduino (pin 6). Therefore I found this script.
click here
I modified this script a little bit for a better overview, the function is the same.
Now I tried to make a pwm-output by using pin 5. So i changed line 18 to:
OCR0B = pgm_read_byte(&sinewave_data[sample]); //(see below)
But it doesn’t work, I get no signals at the output. I tried many more, but I still get no pwm-signals at the output pin 5…

Has anyone perhaps found my mistake?

Many thanks in advance.

Mirko

#include <stdint.h>
#include <avr/interrupt.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#define SAMPLE_RATE 8000 // 8 ksps
#include “sinewavedata.h”

int outputPin = 6; // (PCINT22/OC0A/AIN0)PD6, Arduino Digital Pin 6
int outputPin2 = 5;
volatile uint16_t sample;

// This is called at SAMPLE_RATE kHz to load the next sample.
ISR(TIMER1_COMPA_vect) {
if (sample >= sinewave_length) {
sample = -1;
}
else {
OCR0B = pgm_read_byte(&sinewave_data[sample]); //HERE IS MY CHANGE
}
++sample;

}

void startPlayback()
{
TCCR0A |= _BV(WGM01) | _BV(WGM00);
TCCR0A = (TCCR0A | _BV(COM0A1)) & ~_BV(COM0A0);

TCCR0B &= ~_BV(WGM02);
TCCR0B = (TCCR0B & ~(_BV(CS02) | _BV(CS01))) | _BV(CS00);

TCCR1A = TCCR1A & ~(_BV(WGM11) | _BV(WGM10));

TCCR1B = (TCCR1B & ~_BV(WGM13)) | _BV(WGM12);
TCCR1B = (TCCR1B & ~(_BV(CS12) | _BV(CS11))) | _BV(CS10);

OCR1A = F_CPU / SAMPLE_RATE; // 16e6 / 8000 = 2000

TIMSK1 |= _BV(OCIE1A);

sei(); // enable interrupts
}

void setup()
{
pinMode(outputPin, OUTPUT);
pinMode(outputPin2, OUTPUT);
startPlayback();
}

void loop()
{
while (true);
}

Enable output on OC0B instead of OC0A.

TCCR0A = (TCCR0A | _BV(COM0B1)) & ~_BV(COM0B0);

Section 15.9.1 of datasheet

Many Thanks... The solution was very simple..

Mirko