The following code works.
#include <Arduino.h>
void setup() {
SerialUSB.begin(9600);
while(!SerialUSB);
pinMode(A1, INPUT);
// pinMode(A0, OUTPUT); // DAC port is not specified as OUTPUT
analogReadResolution(10);
analogWriteResolution(10);
while(1){
// analogWrite(A0, pow((double) 2, 32) - 1);
analogWrite(A0, 1023); // max 1023
delay(1000);
float y = analogRead(A1) * 3.3 / 1023L;
SerialUSB.print("DAC Output Voltage: ");
SerialUSB.println(y);
delay(1000);
}
}
void loop() {
}