Kory Hill
/
BMP085_test
Test program of BMP085 pressure sensor
Fork of BMP085_lib by
main.cpp
- Committer:
- newk8600
- Date:
- 2012-11-09
- Revision:
- 4:ae2b8103e52b
- Parent:
- 3:8c00953d4755
File content as of revision 4:ae2b8103e52b:
/* *@file main.cpp * * * * * 1.8 - 3.6V (Vdd) * 1.62 - 3.6 (Vddio) * * *Altitude = 44330*(1-(p/p0)^(1/5.255)) * set p0 to sealevel pressure * delta p = 1hPa = 8.43m at sea level * */ /* *Pinout: *pin9 = SDA *pin10 = SCL *pin11 = XCLR (digital out; active low; Resets sensor) *pin12 = EOC ("end of conversation"; signal when conversion finished) * */ #include "mbed.h" #include "BMP085.h" I2C i2c(p9, p10); // sda, scl BMP085 alt_sensor(i2c); Serial pc(USBTX, USBRX); // tx, rx int main() { pc.baud(9600); //alt_sensor.display_cal_param(&pc); while(1) { pc.printf("Temperature: %d\r\n", alt_sensor.get_temperature()); pc.printf("Pressure: %d\r\n", alt_sensor.get_pressure()); pc.printf("Altitude: %f\r\n", alt_sensor.get_altitude_ft()); wait(0.5); }