hi..
I am trying to interface an I2C temperature sensor to the arduino. i followed the examples for the wire librarary but it doesn't seem to work. when i observe it on the scope i can see some signals flashing on the clock line and SDA. but when i display the returned value it is the same as what i initialized it with...
its a DS1624
Thankyou
does anyone know of anything i might have overlooked. here is my code:
#include <Wire.h>
int temp1=0x11ab;
int temp2=0x7Fcd;
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600); // start serial for output
Wire.beginTransmission(0x90);
Wire.send(0xAC); // access config reg. command
Wire.send(0x4A); // byte to be sent to config.reg
delay(500);
Wire.send(0xEE); // start conversion command
delay(100);
Wire.send(0xAA); // read conversion command
Wire.endTransmission();
}
void loop()
{
Serial.print(temp1,HEX);
Serial.print("-");
Serial.print(temp2,HEX);
Serial.print(" ");
Wire.beginTransmission(0x90);
Wire.send(0xAA); // read conversion command
delay(100);
Wire.endTransmission();
Wire.beginTransmission(0x90);
Wire.requestFrom(0x90, 2);
delay(100);
if(Wire.available())
{
temp1 = Wire.receive();
}
delay(100);
if (Wire.available())
{
temp2 = Wire.receive();
}
// Wire.endTransmission();
Serial.print(temp1,HEX);
Serial.print("-");
Serial.print(temp2,HEX);
Serial.print(" ");
delay(25);