Smart Home Automation Forum

Full Version: [Arduino demo source code for KC868-A4]-06 analog output (DAC) data
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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); 
}
[attachment=550]