marrc
Junior Member level 2
hi guys!
i recently purchased dac mcp 4725 and just tried connecting it to arduino
so i am giving 0-5 v at A0 pin of arduino
problem is Mcp4725 is always op 2v only irrespective of voltage at A0 pin
i think its a coding error
my code is as follows:
A0 pin is connected to center of pot and its other 2 ends to 5v and gnd
A4 to SDA
A5 to SCL
Gnds of arduino and DAc tied
if u need any other info please ping me
cheers,
marrc
i recently purchased dac mcp 4725 and just tried connecting it to arduino
so i am giving 0-5 v at A0 pin of arduino
problem is Mcp4725 is always op 2v only irrespective of voltage at A0 pin
i think its a coding error
my code is as follows:
# include<Wire.h>
# define MCP4725 0x61 //MCP4725 address as 0x61 Change yours accordingly
unsigned int c;
byte buffer[3];
void setup() {
// put your setup code here, to run once:
Wire.begin();
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
c= analogRead(A0)*4; // 0-1023 convert to 0-4096 ie 10 bits to 12 bits
Serial.println(c);
buffer[0]= 0b01000000;
buffer[1]= c>>4; // sending msb values
Serial.println(buffer[1]);
buffer[2]= c<<4; // sending lsb values
Wire.beginTransmission(MCP4725); //Joins I2C bus with MCP4725 with 0x61 address
Wire.write(buffer[0]); //Sends the control byte to I2C
Wire.write(buffer[1]); //Sends the MSB to I2C
Wire.write(buffer[2]); //Sends the LSB to I2C
Wire.endTransmission(); //Ends the transmission
}
A0 pin is connected to center of pot and its other 2 ends to 5v and gnd
A4 to SDA
A5 to SCL
Gnds of arduino and DAc tied
if u need any other info please ping me
cheers,
marrc