#include 
#include 
#include 
SFE_BMP180 bmp180;
DS3231  rtc(SDA, SCL);
int Altitude = 713; //current altitude in meters in my town

void setup() {
  Serial.begin(4800);
  rtc.begin();
  // The following lines can be uncommented to set the date and time
  //rtc.setDOW(WEDNESDAY);     // Set Day-of-Week to SUNDAY
  //rtc.setTime(17, 47, 0);     // Set the time to 12:00:00 (24hr format)
  //rtc.setDate(3, 7, 2021);   // Set the date to January 1st, 2014
  
  bool success = bmp180.begin();

  if (success) {
    Serial.println("BMP180 init success");
  }
}

void loop() {

  char status;
  double T, P;
  bool success = false;

  status = bmp180.startTemperature();
delay(1000);
  if (status != 0) {
  
    status = bmp180.getTemperature(T);

    if (status != 0) {
      status = bmp180.startPressure(3);

      if (status != 0) {
        delay(status);
        status = bmp180.getPressure(P, T);

        if (status != 0) {
          int comp = bmp180.sealevel(P, Altitude);

          Serial.print(" ");
          Serial.print(comp);
          Serial.print(" hPa");

          Serial.print(" * ");
          Serial.print(T);
          Serial.print(" C ");


  // Send date
  Serial.print(rtc.getDateStr());
  Serial.print(" ");
 
  // Send time
  Serial.println(rtc.getTimeStr());
  
        }
      }
    }
  }
}
    

For lighting, electrical, signage, and technology solutions that allow you to do more call Sverige Energy today at +4(670) 4122522.