Hey everyone!
I am new here and new with using Arduino. Anyway, I am using 12-Bit + Sign Temperature Sensor and Thermal Window Comparator with Two-Wire Interface (
http://www.national.com/mpf/LM/LM92.html#Overview), Arduino Uno with Ethernet Shield with microSD slot attached.
First I wanted just read data from sensor and then show results on Serial monitor. With that I didn't have no problem. I think results are good. But then I wanted to save this data on microSD card via Ethernet Shield.
I used one of the example on Arduino home page wich shows how to log data from three analog sensors to an SD card using the SD library. When I run program and then I see, that temperature data are not right.
If anybody knows where is problem or problems

please help me!
Here is code:
#include <SD.h>
#include <Wire.h>
const int chipSelect = 4;
int msb,lsb;
void setup()
{
Wire.begin();
Serial.begin(9600);
Serial.print("Initializing SD card...");
// make sure that the default chip select pin is set to
// output, even if you don't use it:
pinMode(10, OUTPUT);
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
Serial.println("card initialized.");
}
void loop()
{
// make a string for assembling the data to log:
String dataString = "";
Wire.requestFrom(0x4b, 2);
while(Wire.available())
msb = Wire.receive();
lsb = Wire.receive();
float temp = (msb<<8|lsb);
int a =(temp*50)/6400;
dataString += String(a);
dataString += ",";
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
File dataFile = SD.open("datalog.txt", FILE_WRITE);
// if the file is available, write to it:
if (dataFile) {
dataFile.println(dataString);
dataFile.close();
// print to the serial port too:
Serial.print("temperature = ");
Serial.println(dataString);
}
// if the file isn't open, pop up an error:
else {
Serial.println("error opening datalog.txt");
}
delay(500);
}