MCP9808 lukeminen, onnistui!

Oli vähän yritä-erehdy-menetelmä…

Nyt anturi antaa nätisti arvoja, tosin vielä täytyy tehdä muunnos
2-bytestä celsiuksiksi…


#include <Wire.h>
#define address 0x1F
byte upperByte, lowerByte;
float temperature;
void setup(){
  Serial.begin(9600);
  Wire.begin();
}

void loop()
{
  // use the Wire lib to connect to tho rtc
  // reset the resgiter pointer to zero
  Wire.beginTransmission(address);
  Wire.write(address & 0x05);
  Wire.endTransmission();
  // request the 2 bytes of data
  delay(300);
  Wire.requestFrom(address, 2);
  upperByte = Wire.read();
  lowerByte = Wire.read();
  Serial.println("-----------");
  Serial.println(upperByte, HEX);
  Serial.println(lowerByte, HEX);
  
  //Serial.println(temperature);
  delay(1000);
}