Simple DAC output

Hi I'm really new in Arduino.. I'm just trying to get two DAC output from Arduino with one for minimum and another for maximum. can you please help me. to write the code for that.

Thanks in advance

Just use the analogWrite function

You can increase the resolution from the default of 8 bit (upto 12 bits) using the

analogWriteResolution(12) ;

And then provide values from 0… 4095 to analogWrite().


void setup()
  analogWriteResolution (12) ;

void loop()
  for (int i = 0 ; i < 4096 ; i++)
    analogWrite (DAC0, i) ;
    delayMicroseconds (100) ;

(The Due native DAC resolution is 12 bits, the default at start up is only 8 to be
compatible with other Arduinos)

Thanks a lot for the help. it worked.