Untitled
unknown
plain_text
3 years ago
1.1 kB
3
Indexable
#include <SFE_BMP180.h> #include <Wire.h> SFE_BMP180 Basinc; double ilkbasinc; //olculen taban basinci void setup() { Serial.begin(9600); if(Basinc.begin()) { Serial.println("BMP180 basinc hata"); while(1); } ilkbasinc = getPressure(); } // Buraya kadar yaptıgımız tabanbasıncı bulmak ve bu degeri saklamak void loop() { double a,P; P = getPressure(); a = pressure.altitude(P,ilkbasinc); Serial.print("anlık irtifa: "); if (a >= 0.0) Serial.print(" "); Serial.print(a,1); Serial.print(" metre, "); delay(50); } double getPressure() { char status; double T,P,p0,a; status = pressure.startTemperature(); if (status != 0) { delay(status); status = pressure.getTemperature(T); if (status != 0) { status = pressure.startPressure(3); if (status != 0) { delay(status); status = pressure.getPressure(P,T); if (status != 0) { return(P); } } } } }
Editor is loading...