AMBIEN PRESSURE BMP280 SETUP

BMP280

#include <Wire.h>

#include “BMP280.h”

#define P0 1013.25

BMP280 bmp;

void setup(){

if(!bmp.begin()){

Serial.println(“BMP init failed!”);

while(1);

}

else {

Serial.println(“BMP init success!”);

}

bmp.setOversampling(4);

Serial.begin(9600);

Wire.begin();

}

void loop(){

{

double T,P;

char result = bmp.startMeasurment();

if(result!=0){

delay(result);

result = bmp.getTemperatureAndPressure(T,P);

if(result!=0)

{

double A = bmp.altitude(P,P0);

Serial.print(“T = \t”);

Serial.print(T,2);

Serial.print(” degC\t”);

Serial.print(“P = \t”);

Serial.print(P,2);

Serial.print(” mBar\t”);

Serial.print(“A = \t”);

Serial.print(A,2);

Serial.println(” m”);

}

else {

Serial.println(“Error.”);

}

}

else {

Serial.println(“Error.”);

}

delay(100);

}

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s