How does the DAC (12 bit) work on the new Photon?

It Appears there are two pins. Is there any new code required to output the higher resolution, or just the old code, pointing at either of the two pins?

pinging @mdma or @brett on this one (both are traveling at the moment)

thanks zach, I understand it is a really busy week.

When you are using a DAC pin, you can simply write a value from 0 - 4095 to it.

eg. analogWrite(DAC1, 2048);

analogWrite will check if it is a DAC pin and do a HAL_DAC_Write instead of a normal HAL_PWM_Write

Long story short, all you need to do with a DAC pin is to use it normally with a 0-4095 value.

3 Likes

^^ Exactly what that man said! :+1: