I'm trying to assign the output of my function (which adjusts a DAC output) to a variable so I can print and display it in my serial monitor. Here's the code
#include <Wire.h>
#include <Adafruit_MCP4725.h>
Adafruit_MCP4725 dac;
int volza;
void setup() {
Serial.begin(38400);
Serial.println("Hello!");
dac.begin(0x60);
}
void loop() {
volza = dac.setVoltage(1095, 1); // THIS IS THE PROBLEM
Serial.println(volza);
}
I am receiving an error because of the commented line. I knowthink it's because I am trying to return a value while inside a void loop. How do you fix this?