Smart Home Automation Forum
A24 arduino demo source code-07-analog out (DAC) - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KinCony A24 (https://www.kincony.com/forum/forumdisplay.php?fid=56)
+--- Thread: A24 arduino demo source code-07-analog out (DAC) (/showthread.php?tid=4038)



A24 arduino demo source code-07-analog out (DAC) - KinCony Support - 12-25-2023

Code:
#include "DFRobot_GP8403.h"
#include "Wire.h"
DFRobot_GP8403 dac(&Wire,0x58);

void setup() {
  Serial.begin(115200);
  Wire.begin(16,5);
  while(dac.begin()!=0){
    Serial.println("init error");
    delay(1000);
   }
  Serial.println("init succeed");
  //Set DAC output range
  dac.setDACOutRange(dac.eOutputRange10V);
  dac.setDACOutVoltage(10000, 0);
  dac.setDACOutVoltage(10000, 1);
  delay(1000);
  //Store data in the chip
  dac.store();
}

void loop(){
}