I'm just trying to put an RGB LED on my Particle Photon. Pins D0 and D1 are already occupied for an I2C device, and pins RX and TX are already occupied for a serial device.
According to the docs, I should have 3 more PWM pins:
Particle Photon boards have 9 PWM pins: D0, D1, D2, D3, A4, A5, WKP, RX, TX. However there’s a note: PWM timer peripheral is duplicated on two pins (A5/D2) and (A4/D3) for 7 total independent PWM outputs. For example: PWM may be used on A5 while D2 is used as a GPIO, or D2 as a PWM while A5 is used as an analog input. However A5 and D2 cannot be used as independently controlled PWM outputs at the same time. See: https://docs.particle.io/datasheets/photon-datasheet/
Technically 5, but since two of them are shared, this brings it down to 3. 3 is all I need for an RGB LED, so I hooked it up to A4, A5 and A7/WKP.
I am able to get each individual color to light up, red green and blue, by analogWrite-ing each pin as 255 one at a time.
I am NOT able to combine two or three pins at the same time. If I analogWrite all three pins 255 at the same time, only red (A7/WKP) shows up.
Same for just two pins at a time. Same if I replace analogWrite with digitalWrite (which is really weird, that's not even PWM!). Same if I try swapping A4 and A5 for D2 and D3. Same if I try swapping out a new RGB LED (I have a hundred, and can confirm they all work fine and can make white light on other devices).
Even if I do all this in void setup, before the i2c and serial devices have begun doing anything, this happens. Although in theory, according to the docs, they shouldn't interfere.
Here is my code, although it's pretty long and complex, the relevant routine is the ledcycle():
I did find this thread from 8 years ago with someone who had the exact same issue on the exact same pins, and it appears it was never resolved. The last few commenters confused the author's attempts on A4/A5/A7 for his earlier attempt on A4/A5/A6, which of course won't work because A6 is a DAC, but never explained why he couldn't get it to work on A4/A5/A7.