void loop()
{
Serial.print("temperature in Celsius: ");
//let's signal we're about to do something
int temperature;
//temperature in a byte
Wire.beginTransmission(address);
//start the transmission
Wire.send(0x00);
Wire.requestFrom(address, 1);
if (Wire.available()) {
temperature = Wire.receive();
Serial.println(temperature);
} else {
Serial.println("---");
}
Wire.endTransmission();
//end the transmission
delay(delayC);
}
When i run this code, i get "Temperature in celsius: ----" on serial monitor. I guess the device tmp100 is not giving any data to arduino over i2c. I checked address of tmp100 again and temperature register too. Both look fine. I don't understand what the problem is?
Please help!
Any chance you could post a link to the data sheet -- preferably from the manufacturers site? The one that shows the registers and recommended code is helpful. Who made it and what is the full part number.
Did you look for a library or working program for that device??
Thanks Rob. But i had checked that link already. I have tried some other variations in program also. Few libraries like I2Cmaster etc too!
Now i guess..the problem is in hardware, not the code. I have redesigned the tmp100 board. I'll get it manufactured in couple of days time and try out everything on it again.
Fingers crossed!
Problem is with your code. You need a Wire.endTransmission after your Wire.send and you need to delete the Wire.endTransmission at the end of the sketch.