Just thought I'd post this out there for those that want to use this chip but don't have code for it. As far as I know it's still available in the free sample program but does require an SOIC to DIP adapter for breadboarding.
Should be easy to follow my code. Let me know if you have any questions and if there is any other place I should posting this kinda stuff instead.
#include <Wire.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//Define ADT7410 address and Register Addresses. ***This assumes A0 and A1 are grounded.***
#define ADT7410Address 0x48
#define ADT7410TempReg 0x00
#define ADT7410ConfigReg 0x03
// RAW 16-bit, signed data from ADT7410.
// (tempReading / 128) for positive temps in Celcius.
// ((tempReading - 65536) / 128) for negative temps in Celcius.
// For Farenheight ((ABOVERESULT * 1.8) + 32).
int tempReading = 0;
// Define values in final form. They are in FLOAT form for best precision, use int if you don't need decimal.
float finalTempF = 0.0000;
float finalTempC = 0.0000;
void setup() {
//BEGIN LCD Code
lcd.begin(16,2);
lcd.clear();
//END LCD Code
Wire.begin();
// Initialize the ADT7410.
ADT7410INIT();
}
void loop() {
ADT7410GetTemp();
finalTempF = (((tempReading/128.0) * 1.8) + 32);
finalTempC = (tempReading/128.0);
lcd.setCursor(0,0);
lcd.print(finalTempF);
lcd.print(B11011111,BYTE); // Degree symbol.
lcd.print('F');
lcd.setCursor(0,1);
//lcd.print('RAW = ');
//lcd.print(tempReading);
lcd.print(finalTempC);
lcd.print(B11011111,BYTE); // Degree symbol.
lcd.print('C');
delay(500); // Doesn't need to be here. Just keeps my LCD from going nuts.
}
void ADT7410INIT() {
//Initialization of the ADT7410 sets the configuration register based on input from the
//Analog Devices datasheet page 14. 16-bit resolution selected.
Wire.beginTransmission(B1001000);
Wire.send(0x03);
Wire.send(B10000000);
Wire.endTransmission();
}
void ADT7410GetTemp()
{
byte MSB;
byte LSB;
// Send request for temperature register.
Wire.beginTransmission(ADT7410Address);
Wire.send(ADT7410TempReg);
Wire.endTransmission();
// Listen for and acquire 16-bit register address.
Wire.requestFrom(ADT7410Address,2);
MSB = Wire.receive();
LSB = Wire.receive();
// Assign global 'tempReading' the 16-bit signed value.
tempReading = ((MSB << 8) | LSB);
}