Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DAC on the KC868-a6
#1
Hi, I'm working on a project where I need to control a 0-10V fan. I was going to use the two DAC channels on the KC868-a6 development board but without success. from the following code, I couldn't get a measurement with my multimeter  

Code:
/*KC868-A6 DAC CODE*/
#define DAC1 26
#define DAC2 25

void setup() {
  //Serial.begin(115200);

}

void loop() {

  dacWrite(DAC1, 127);
  dacWrite(DAC2, 127);

  delay(2000);

  dacWrite(DAC1, 255);
  dacWrite(DAC1, 255);

  delay(2000);
}
can someone help me with how to use the DAC?
Reply
#2
here is DAC arduino demo code for A6: https://www.kincony.com/forum/showthread.php?tid=1861
dacWrite(DAC2, 255); that means: output 10v
dacWrite(DAC2, 0); that means: output 0v
so you just need to replace the number will output different voltage.
Reply
#3
Note that it is rather confusing that the Kincony KC868-A6 labels the DAC outputs the wrong way around.
"DAC1" corresponds to GPIO26 (DAC2), whereas DAC2 corresponds to GPIO25(DAC1)

This has often led me to the think the DAC output isn't working, whereas it actually is, just on the wrong terminal.

[Image: TUu6Wq3.png]
Reply
#4
do you means exchange the lable of DAC1 and DAC2?
Reply
#5
Yes. The Kincony labelled diagrams show the pins laid out like this, and the demo code declares `DAC1 = 26, DAC2 = 25`.

But, the ESP32 CPU schematic (as shown in my previous post), and also the pin definitions the Arduino ESP32 libary have them the other way around: 
```DAC1 = 25, DAC2 = 26.```

See here for where they are defined: https://github.com/espressif/arduino-esp...uino.h#L49


[Image: S261a41c1a8a344a0b41f29984edaf26eG.jpg_9....jpg_.avif]
Reply
#6
sorry, in future we will update the photo.
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)