Smart Home Automation Forum

Full Version: A24 arduino demo source code-07-analog out (DAC)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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(){
}
[attachment=3816]