Smart Home Automation Forum
[Arduino demo source code for KC868-A4]-06 analog output (DAC) data - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KC868-A4 (https://www.kincony.com/forum/forumdisplay.php?fid=21)
+--- Thread: [Arduino demo source code for KC868-A4]-06 analog output (DAC) data (/showthread.php?tid=1645)



[Arduino demo source code for KC868-A4]-06 analog output (DAC) data - KinCony Support - 01-07-2022

Code 5: //The demo code is DAC    You can copy the code to your Arduino IDE

Code:
#define DAC1 26   //DAC1 IO26
//#define DAC2 25   //DAC2 IO25

void setup() {
 
}

void loop() {
  int Value = 127; //255= 10V
 
  dacWrite(DAC1, 1);
  delay(500);
  dacWrite(DAC1, 50);
  delay(500);
  dacWrite(DAC1, 100);
  delay(500);
  dacWrite(DAC1, 150);
  delay(500); 
  dacWrite(DAC1, 255);
  delay(500); 
}