I've got the AK8975_MPUEVB_heading sketch running on it's own.
When I add the code to my sketch it says it is running but returns
zeros for x,y,z. When the timer0 code is implemented.
//Timer0
TCCR0A = _BV(COM0A1) | _BV(COM0B1) | _BV(WGM00); // 1010 0001
//This set Timer0 into Mode 2/CTC Top = OCR0A
TCCR0B = _BV(CS00); // 0000 0001
//Timer1
TCCR1A = _BV(COM1A1) | _BV(COM1B1) | _BV(WGM10);
TCCR1B = _BV(CS10);
//Timer2
TCCR2A = _BV(COM2A1) | _BV(COM2B1) | _BV(WGM20);
TCCR2B = _BV(CS20);
//End timer setup
//This activates Timer0
TIMSK1 |= _BV(TOIE1);
Without the timer0 code everything works.
Clearly there is a connection between timer0 and I2C but I have no
clue. Can anyone help?