Having trouble understanding how this DAC functions. I'm not even sure if my Result conversion is correct, but overall code is working nonetheless. Can someone help explain?
Output on Sketch monitor: 510
Also checked the Vout pin with a voltmeter: 2.3V (so i think I understand where the 510 comes from)
But what if wanted 5V (1023 on sketch). Is that even possible?
//Include the Wire Library
#include <Wire.h>
//Set up the address of the D-A sensor
#define ADDRESS 0x73
byte da_MSB;
byte da_LSB;
int Result;
void setup()
{
Serial.begin(9600);
Wire.begin();
}
void loop()
{
//Send a Request
//Start Talking
Wire.beginTransmission(ADDRESS);
//Ask for Register one
Wire.write(1);
//Complete Transmission
Wire.endTransmission();
//Request 2 byte
Wire.requestFrom(ADDRESS, 2);
//wait for a response
while(Wire.available() == 1); //same as register one
da_MSB = Wire.read();
da_LSB = Wire.read();
Result = (da_MSB)+da_LSB;
Serial.println(Result);
//delay, then loop
delay(500);
}