It looks like there have been some reshuffling with the Leonardo board. Too bad, as this breaks compatability with some shields. Even worse, as I am a first time Arduino user and have been tring to fix this for quiet some time.
I am using AdaFruit Motor Shield (http://adafruit.com/products/81
) which uses Timer0 and Timer2 on the Arduino Uno and pins 3 & 11 and 5 & 6.
It's easy to substitute Timer2 (Uno) on pins 3 & 11 with Timer0 (Leo), using on the same pins, but Timer 4 (Leo), that I want to use instead of Timer0 (Uno) is a bit more advanced and has different setup.
The code for the Uno, that I have is:
TCCR0A |= _BV(COM0B1) | _BV(WGM00) | _BV(WGM01); // fast PWM, turn on oc0a
OCR0B = 0;
The code, that I am going to try is:
TCCR4A |= _BV(COM4A0) | _BV(PWM4A); // fast PWM, turn on OC4A
TCCR4D |= _BV(WGM40) | _BV(WGM41);
OCR4A = 0;
OC4A on Pin 6 is complimentary to P13. Does that mean, that both of them are set?
Is this the correct setup to use Timer4 on the Arduino Leonardo as a fast-PWM 8-bit timer, similar to Timer0 on the Uno?