Skip to content
forked from pilotak/LPS35HW

Pressure sensor library for Arduino

License

Notifications You must be signed in to change notification settings

LeSuedois/LPS35HW

 
 

Repository files navigation

LPS35HW pressure sensor library (I2C)

Build Status Framework Badge Arduino

Fully compatible with following barometers

  • LPS22HB
  • LPS33W
  • LPS33HW

This library works with metric units, if you need imperial please consider using MeteoFunctions library, please see example below.

#include <Wire.h>
#include "LPS35HW.h"
#include "MeteoFunctions.h"

LPS35HW lps;
MeteoFunctions calc;

const float above_sea = 1000;  // ft

void setup() {
    Serial.begin(9600);
    Serial.println("LPS barometer test");

    if (!lps.begin()) {
        Serial.println("Could not find a LPS barometer, check wiring!");

        while (1) {}
    }
}

void loop() {
    float pressure = lps.readPressure();
    float temp = calc.c_f(lps.readTemp());

    Serial.print("Pressure: ");
    Serial.print(calc.relativePressure_f(pressure, above_sea, temp));
    Serial.print("inHg\ttemperature: ");
    Serial.print(temp);
    Serial.println("*F\n");

    delay(1000);
}

About

Pressure sensor library for Arduino

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 100.0%