Professional Documents
Culture Documents
This example is for Wiring version 1.0 build 0100+. If you have a previous version, use the
examples included with your software. If you see any errors or have comments, please let us know.
tmp102 temperature sensor by BARRAGAN (http://barraganstudio.com)
Demonstrates use of the Wire library reading data from the tmp102 temperature sensor On
Wiring v1 boards the SCL and SDA pins are: 0 and 1 On
// shift the address 1 bit right (0x91 or 0x90), the Wire library only needs the 7
byte msb;
byte lsb;
int temperature;
void setup(){
void loop(){
Wire.requestFrom(sensorAddress,2);
if (2 <= Wire.available()) // if two bytes were received
{
msb = Wire.read(); // receive high byte (full degrees)
Serial.println(temperature*0.0625);
}
delay(500); // wait for half a second