/* * PT1000 Test-Code * RIBU Elektronik e.U. * Anton Buchgraber * 2021 * * Reads the Temperature, ID and Version from the RIBU Elektronik PT1000 Measurement Board (Testet on ESP32 and ESP8266 Boards) * * */ #include #define i2c_addr 0x3F byte temp; void setup() { Serial.begin(115200); delay(10); } void loop() { Wire.begin(); //Wire.beginTransmission(i2c_addr); //Wire.write(0x0); //Wire.endTransmission(); Wire.requestFrom(i2c_addr, 5); // Read Grad HIGH temp = Wire.read(); Serial.println(temp, BIN); int temperatur_wert = temp * 256; Serial.println(temperatur_wert, BIN); // Read Grad LOW temp = Wire.read(); Serial.println(temp, BIN); temperatur_wert += temp; Serial.println(temperatur_wert, BIN); // Read ID HIGH temp = Wire.read(); Serial.println(temp, BIN); int id_wert = temp * 256; Serial.println(id_wert, BIN); // Read ID LOW temp = Wire.read(); Serial.println(temp, BIN); id_wert += temp; Serial.println(id_wert, BIN); // Read Version temp = Wire.read(); Serial.println(temp, BIN); byte version_wert = temp; float helpwert = temperatur_wert / 64.0; helpwert -= 256; Serial.print(helpwert); Serial.println("°C"); Serial.print("ID: "); Serial.println(id_wert); Serial.print("V: "); Serial.println(version_wert); delay(1000); }