One more thing I found...this caused me a real headache!
If I write the code like this it works:
// Timer 0 -> Output on OC0A
TCCR0A = _BV(WGM01) // CTC mode
|_BV(COM0A0); // Toggle OC0A output on every match
OCR0A = 4; // Reset when it reaches this value
TCCR0B = _BV(CS00); // Start timer, no prescale
If I write the code like this, it doesn't:
// Timer 0 -> Output on OC0A
OCR0A = 4; // Reset when it reaches this value
TCCR0A = _BV(WGM01) // CTC mode
|_BV(COM0A0); // Toggle OC0A output on every match
TCCR0B = _BV(CS00); // Start timer, no prescale
I switched the two lines around when I was cleaning up the code a bit. It took me a whole day to figure out what had happened.