First, I don't think this is the right topic, but I couldn't find anything more appropriate. Sorry if I missed something.
I'm trying to get three distinct PWM signals out of an Uno Rev3. Same frequency, different duty cycles. Since the Uno has three timers with two channels each, I thought I'd use timer 0 and 2, since they have the same resolution.
The way I set it up is that I use pin 5 and 6 from timer 0, and 11 from timer 2. Here's how I initialize the timers:
From my understanding, I'm configuring them in the following way:
Timer 0 is using Fast PWM, prescaler is 32, channel A and B (pins 5 and 6) are cleared on compare match and set at 0.
Timer 2 is using Fast PWM, prescaler is 32, channel A (pin 11) is cleared on compare match and set at 0, while B is disabled
Then, I set OCR0B, OCR0A, and OCR2A to 5. Connecting an RGB LED to those, I'm seeing only green and blue light up, i.e. pin 6 and 11. Pin 5 doesn't emit any signal. I don't have an oscilloscope or something similar to check what the pins are actually doing, unfortunately.
Changing the code up a bit to use both pins from timer 2 and one from timer 0, I get the exact same issue. I don't even know why that specific pin is the one working.
I do have a scope, and since you were clear about what you're doing (unlike a lot of people who post here!) I was able to make a sketch very easily with your 4 setup lines, plus
OCR0B = 5;
OCR0A = 5;
OCR2A = 5;
The result was that I saw positive pulses of 24usec width on pins 5 and 6, and 12usec on pin 11. For pins 5 and 6, the rate was slightly slower than 1KHz, and for pin 11, it was slightly slower than 2KHz. I don't know if that will surprise you or not! I used a Nano, but it should be the same.
Edit to say: I didn't initially check to see if the output on pin 11 was exactly twice the frequency of the other two, but in fact it is. And the pulse on pin 11 goes high and low during the pulse from 5 and 6, but none of the edges coincide.
@Beminetonight: That was incredibly useful. Since your experiment succeeded, I went back and thought: what about the pin itself? So I discarded the whole timer setup and just set pin 5 high. Something must've happened with it during storage or travel (it was shipped 2000km from my previous house, with other things), because the pin itself isn't working.
So then I went and tried timer 2 again. Used pins 3 and 11, and it works perfectly. I probably missed something last time, but all three signals are working now.
It shouldn't be the same. See the datasheet - prescaler setting tables for Timer0 and Timer2 are different. Bits CS00 and CS01 will give you prescaler = 64 for Timer0, but CS20 & CS21 in Timer2 - prescaler=32 only