A am new to AVR programming. I have an Attiny85 and an LED hooked up to pin 5 on the chip (PB0). My goal is to get the LED to fade on, then turn off and repeat. When I give power to the chip the LED lights up very little. It is a very faint glow. It stays the same brightness for several seconds then lights up to its full brightness. Below is my code.

The datesheet of Attiny85


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

double dutyCycle = 0;

int main() {

DDRB = (1 << PORTB0); // Set PB0 as output

TCCR0A = (1 << COM0A1) | (1 << WGM00) | (1 << WGM01); // Clear OC0A on compare, WGMxx selscts fast mode
TIMSK = (1 << TOIE0);

OCR0A = (dutyCycle / 100.0) * 255.0;

sei();

TCCR0B = (1 << CS00); // Set prescalar and start timer

while (1) {
_delay_ms(100);
dutyCycle = dutyCycle + 15;

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

return 0;
}

ISR(TIMER0_OVF_vect) {
OCR0A = (dutyCycle / 100.0) * 255.0;
}

I tried changing the type of the dutyCycle variable to an uint8_t but the results were the same. I removed the '.0' from some and all of the math calculations but again the results were the same.