ANALOG OUTPUT (PHOTON) doesn't work

No idea if this has anything to do with this, but currently it seems that you have to set pinMode(DAC, OUTPUT); everytime before using analogWrite(DAC, x);.
This has been found and doced a while back
https://docs.particle.io/reference/firmware/photon/#analog-output-photon-

NOTE: While for PWM pins one single call to pinMode(pin, OUTPUT); sets the pin mode for multiple analogWrite(pin, value); calls, for DAC pins you need to set pinMode(DAC, OUTPUT); each time anew you want to perform an analogWrite().

analogWrite DAC only once for each pinMode( ,OUTPUT)
https://github.com/spark/firmware/issues/662

1 Like