Include
Include
Include
h>
void setup() {
Wire.begin();
Serial.begin(9600);
delay(100);
void readUT() {
Wire.beginTransmission(0x77);
Wire.write(0xF4);
Wire.write(0x2E);
Wire.endTransmission(false);
delayMicroseconds(4500);
Wire.beginTransmission(0x77);
Wire.write(0xF6);
Wire.endTransmission(false);
Wire.requestFrom(0x77, 2);
uint8_t msb = Wire.read();
uint8_t lsb = Wire.read();
UT = static_cast<uint16_t>((uint16_t(msb) << 8) | lsb);
}
void temp() {
long x1 = (UT - _AC6) * (_AC5 / pow(2, 15));
long x2 = _MC * pow(2, 11) / (x1 + _MD);
B5 = x1 + x2;
long T = (B5 + 8) / pow(2, 4);
Serial.print("Uncompensated temp value: ");
Serial.println(UT);
Serial.print("Ambient temp value: ");
Serial.println(float(T) / 10);
}
delay(70);
UP = 0;
Wire.beginTransmission(0x77);
Wire.write(0xF6);
Wire.endTransmission(false);
Wire.requestFrom(0x77, 3);
for (int i = 0; i < 3; i++) {
UP <<= 8;
UP |= Wire.read();
}
UP >>= (8 - oss);
Serial.println(UP);
}
void loop() {
readUT();
readUP(3);
temp();
pressure(3);
delay(1000);
}