Photon DAC responds to analogWrite inverse of expected

Was doing some initial experimenting with the DAC analog output on my Photon and ran into a weird situation. According to the docs and common sense the larger analogWrite() values are supposed to correspond to higher pin voltages. What I’m seeing is that when I analogWrite(DAC, 0) I get close to 3.3v but when I analogWrite(DAC, 4095) I get close to 0.0v. The behavior seems to be linear in-between too.

Of course I’m second-guessing what I might have damaged now, as I may have briefly touched Vin (~5v) to the DAC pin, but having a functional but inverse behavior seems like a rather unusual failure mode. Anyone know what’s going on?

This sounds like what you would get if you measured the voltage between the DAC pin and the 3.3 volt pin, instead of ground. Are you sure you’re measuring to ground?

1 Like